# -*- coding: utf-8 -*- 
#
# Description:
#
#  Definiton
#
#
#
# Changes:
#
# 2012-01-10
# Initial Commit
#
#
# Copyright 2010-2012, WyDev Team.
# Author: Polo35 (polo35580@hotmail.fr)
#
# Licenced under Academic Free License version 3.0
# Review WyGui README & LICENSE files for further details.

nname: 0
n 0(None)[self._caption = caption
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76fb7ac>}
nname: 0
n 0(None)[return _(self._caption)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76fb8ac>}
nname: 6
n 6(None)[def __init__(self, caption):
	self._caption = caption

def __str__(self):
	return _(self._caption)

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb76fb40c>}
nname: 0
n 0(None)[self.args = args
self.label = label
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76fb90c>}
nname: 6
n 6(None)[def __init__(self, label, *args):
	self.args = args
	self.label = label

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb76fb44c>}
nname: 0
n 0(None)[return _('Press Home to switch universe')
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7695a8c>}
nname: 0
n 0(None)[return Task(self.device_plugged, obj, True).start(0)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7695cac>}
nname: 0
n 0(None)[return Task(self.device_plugged, obj, True).start(0)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7695ccc>}
nname: 0
n 0(None)[return Task(self.device_plugged, obj, False).start(0)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7695a2c>}
nname: 0
n 0(None)[return Task(self.device_plugged, obj, False).start(0)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7695d0c>}
nname: 0
n 0(None)[self.eventHandler = EventDispatcher(self)
self._navigator = None
Menu.__init__(self, 'root', type='root')
def self._getitems_keywords['message']():
	return _('Press Home to switch universe')

import wymedia.wmplus as w
w.register_plug_callback((lambda obj: Task(self.device_plugged, obj, True).start(0)))
w.register_unplug_callback((lambda obj: Task(self.device_plugged, obj, False).start(0)))
from peewee.controlmode import ControlModeManager
ctrl = ControlModeManager()
ctrl.register_observer(self.control_changed)
pygui_globs['controlmodemanager'] = ctrl
self._controlmode_popup = None
self.active_univ = None
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7690f6c>}
nname: 68
n 68(None)[]:
	i: 47(), 67()
	o: 

nname: 67
n 67(None)[]:
	i: 0&31(f)
	o: 68()

nname: 47
n 47(None)[louie_send('show_select_universe', sender=self)
]:
	i: 0&31(t)
	o: 68()

nname: 0&31
n 0&31('restore_last_universe' in plugins and not user_config['advanced']['last_universe'])[Menu.show(self, hide_previous_menu, timeout)
]:
	i: 
	o: 47(t), 67(f)

nname: 0&31
n 0&31(None)[Menu.show(self, hide_previous_menu, timeout)
if 'restore_last_universe' in plugins and not user_config['advanced']['last_universe']:
	louie_send('show_select_universe', sender=self)
]:
	i: 
	o: 

self.nodes: {'0&31': <unpyclib.structure.node instance at 0xb7690b2c>}
nname: 322
n 322(None)[return None
]:
	i: 183(), 288()
	o: 

nname: 288
n 288(None)[self._controlmode_popup = MessageWindow(msg, button=None)
self._controlmode_popup.show()
]:
	i: 260(), 287()
	o: 322()

nname: 287
n 287(None)[]:
	i: 214(t)
	o: 288()

nname: 260
n 260(None)[stack.back_to_home()
BSoDMenu().show()
]:
	i: 214(f)
	o: 288()

nname: 214
n 214(stack.is_on_firstboot())[events_drop(True)
plugins.add('popup_blocker')
stack = pygui_globs['menustack']
]:
	i: 0(f)
	o: 260(f), 287(t)

nname: 183
n 183(None)[MessageWindow(msg, button=None).show(timeout=3)
]:
	i: 168(), 182()
	o: 322()

nname: 182
n 182(None)[]:
	i: 123(t)
	o: 183()

nname: 168
n 168(None)[stack.back_to_home()
]:
	i: 123(f)
	o: 183()

nname: 123
n 123(stack.is_on_firstboot())[events_drop(False)
plugins.discard('popup_blocker')
stack = pygui_globs['menustack']
]:
	i: 96(), 122()
	o: 168(f), 182(t)

nname: 122
n 122(None)[]:
	i: 86(f)
	o: 123()

nname: 96
n 96(None)[self._controlmode_popup.hide()
self._controlmode_popup = None
]:
	i: 86(t)
	o: 123()

nname: 86
n 86(self._controlmode_popup)[]:
	i: 0(t)
	o: 96(t), 122(f)

nname: 0
n 0(rcu)[from peewee.notifier import events_drop
from pygui.facilities.power import PowerManager
from pygui.menu.menu.bsod import BSoDMenu
log.debug('Control changed: mode=%s rcu=%s standby=%s', mode, rcu, standby)
msg = control_mode_popup_dict[mode]
]:
	i: 
	o: 86(t), 214(f)

nname: 322
n 322(None)[return None
]:
	i: 183(), 214()
	o: 

nname: 214
n 214(None)[events_drop(True)
plugins.add('popup_blocker')
stack = pygui_globs['menustack']
if not stack.is_on_firstboot():
	stack.back_to_home()
	BSoDMenu().show()
self._controlmode_popup = MessageWindow(msg, button=None)
self._controlmode_popup.show()
]:
	i: 0(f)
	o: 322()

nname: 183
n 183(None)[MessageWindow(msg, button=None).show(timeout=3)
]:
	i: 86()
	o: 322()

nname: 86
n 86(None)[if self._controlmode_popup:
	self._controlmode_popup.hide()
	self._controlmode_popup = None
events_drop(False)
plugins.discard('popup_blocker')
stack = pygui_globs['menustack']
if not stack.is_on_firstboot():
	stack.back_to_home()
]:
	i: 0(t)
	o: 183()

nname: 0
n 0(rcu)[from peewee.notifier import events_drop
from pygui.facilities.power import PowerManager
from pygui.menu.menu.bsod import BSoDMenu
log.debug('Control changed: mode=%s rcu=%s standby=%s', mode, rcu, standby)
msg = control_mode_popup_dict[mode]
]:
	i: 
	o: 86(t), 214(f)

nname: 322
n 322(None)[return None
]:
	i: 86(), 214()
	o: 

nname: 214
n 214(None)[events_drop(True)
plugins.add('popup_blocker')
stack = pygui_globs['menustack']
if not stack.is_on_firstboot():
	stack.back_to_home()
	BSoDMenu().show()
self._controlmode_popup = MessageWindow(msg, button=None)
self._controlmode_popup.show()
]:
	i: 0(f)
	o: 322()

nname: 86
n 86(None)[if self._controlmode_popup:
	self._controlmode_popup.hide()
	self._controlmode_popup = None
events_drop(False)
plugins.discard('popup_blocker')
stack = pygui_globs['menustack']
if not stack.is_on_firstboot():
	stack.back_to_home()
MessageWindow(msg, button=None).show(timeout=3)
]:
	i: 0(t)
	o: 322()

nname: 0
n 0(rcu)[from peewee.notifier import events_drop
from pygui.facilities.power import PowerManager
from pygui.menu.menu.bsod import BSoDMenu
log.debug('Control changed: mode=%s rcu=%s standby=%s', mode, rcu, standby)
msg = control_mode_popup_dict[mode]
]:
	i: 
	o: 86(t), 214(f)

nname: 0
n 0(None)[from peewee.notifier import events_drop
from pygui.facilities.power import PowerManager
from pygui.menu.menu.bsod import BSoDMenu
log.debug('Control changed: mode=%s rcu=%s standby=%s', mode, rcu, standby)
msg = control_mode_popup_dict[mode]
if rcu:
	if self._controlmode_popup:
		self._controlmode_popup.hide()
		self._controlmode_popup = None
	events_drop(False)
	plugins.discard('popup_blocker')
	stack = pygui_globs['menustack']
	if not stack.is_on_firstboot():
		stack.back_to_home()
	MessageWindow(msg, button=None).show(timeout=3)
else:
	events_drop(True)
	plugins.add('popup_blocker')
	stack = pygui_globs['menustack']
	if not stack.is_on_firstboot():
		stack.back_to_home()
		BSoDMenu().show()
	self._controlmode_popup = MessageWindow(msg, button=None)
	self._controlmode_popup.show()
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb769b10c>}
nname: 657
n 657(None)[return None
]:
	i: 648(JA), 653(), 656()
	o: 

nname: 656
n 656(None)[]:
	i: 348&369(f)
	o: 657()

nname: 653
n 653(None)[]:
	i: 621(JA), 652()
	o: 657()

nname: 652
n 652(None)[]:
	i: 570(f)
	o: 653()

nname: 648
n 648(None)[]:
	i: 588(t)
	o: 657(JA)

nname: 621
n 621(None)[log.debug('calling build_preview()')
nav.build_preview()
]:
	i: 588(f)
	o: 653(JA)

nname: 588
n 588(nav._history)[log.debug('calling _refresh_root()')
nav._refresh_root()
]:
	i: 570(t)
	o: 621(f), 648(t)

nname: 570
n 570(stack.get_navigator() is nav)[]:
	i: 556(), 569()
	o: 588(t), 652(f)

nname: 569
n 569(None)[]:
	i: 382(t)
	o: 570()

nname: 556
n 556(None)[nav._update_marker()
]:
	i: 510(AL), 555()
	o: 570()

nname: 555
n 555(None)[]:
	i: 529(AF), 539()
	o: 556()

nname: 539
n 539(None)[for mlist in markerlists():
mlist._refresh()
]:
	i: 529(for)
	o: 555()

nname: 529
n 529(None)[]:
	i: 510(loop)
	o: 539(for), 555(AF)

nname: 510
n 510(None)[from pygui.markerlist import markerlists
]:
	i: 472(), 509()
	o: 529(loop), 556(AL)

nname: 509
n 509(None)[]:
	i: 466(f)
	o: 510()

nname: 472
n 472(None)[stack.close_player()
stack.back_to_menu(nav)
nav.back_to_root()
]:
	i: 466(t)
	o: 510()

nname: 466
n 466(concerned)[]:
	i: 389(AL), 465()
	o: 472(t), 509(f)

nname: 465
n 465(None)[]:
	i: 399(AF), 461()
	o: 466()

nname: 461
n 461(None)[]:
	i: 409&422(f), 450()
	o: 465()

nname: 450
n 450(None)[concerned = True
break
continue
]:
	i: 409&422(t)
	o: 461()

nname: 409&422
n 409&422(h['selected'] and h['selected'].wymedia_resource['id'] == obj['id'])[for h in nav._history:
]:
	i: 399(for)
	o: 450(t), 461(f)

nname: 399
n 399(None)[]:
	i: 389(loop)
	o: 409&422(for), 465(AF)

nname: 389
n 389(None)[concerned = False
]:
	i: 382(f)
	o: 399(loop), 466(AL)

nname: 382
n 382(plugged)[]:
	i: 348&369(t)
	o: 389(f), 569(t)

nname: 348&369
n 348&369(nav is not None and nav in stack)[nav = self._navigator
]:
	i: 324(), 347()
	o: 382(t), 656(f)

nname: 347
n 347(None)[]:
	i: 296&308(f)
	o: 348&369()

nname: 324
n 324(None)[pygui_globs['psp_path'] = obj.get('uri')
]:
	i: 296&308(t)
	o: 348&369()

nname: 296&308
n 296&308('transcode' in plugins and name.startswith('"PSP"'))[]:
	i: 263(), 295()
	o: 324(t), 347(f)

nname: 295
n 295(None)[]:
	i: 238&250(t)
	o: 296&308()

nname: 263
n 263(None)[MessageWindow(msg, button=None).show(timeout=3)
]:
	i: 238&250(f)
	o: 296&308()

nname: 238&250
n 238&250('popup_blocker' in plugins and stack.get_player())[]:
	i: 203(JA), 220(JA), 234(), 237()
	o: 263(f), 295(t)

nname: 237
n 237(None)[]:
	i: 175(f)
	o: 238&250()

nname: 220
n 220(None)[PRINT_EXCEPTION()
]:
	i: 199(except)
	o: 238&250(JA)

nname: 203
n 203(None)[UpdateManager().unplug_update()
]:
	i: 199(try)
	o: 238&250(JA)

nname: 199
n 199(None)[]:
	i: 175(t)
	o: 203(try), 220(except)

nname: 175
n 175(obj.get('backend', '') != 'upnp')[]:
	i: 140(JA), 170(), 174()
	o: 199(t), 237(f)

nname: 174
n 174(None)[]:
	i: 63(f)
	o: 175()

nname: 170
n 170(None)[]:
	i: 117(f)
	o: 175()

nname: 140
n 140(None)[from pygui.facilities.demomode import handle_demo
handle_demo(obj)
]:
	i: 117(t)
	o: 175(JA)

nname: 117
n 117('WYDEMO' in obj['title'].upper())[]:
	i: 63(t)
	o: 140(t), 170(f)

nname: 63
n 63(plugged)[msg = msg_template % {'name': name}
log.debug('%s / %s', msg, name)
stack = pygui_globs['menustack']
]:
	i: 34(), 50()
	o: 117(t), 174(f)

nname: 50
n 50(None)[msg_template = _('Device "%(name)s" removed.')
]:
	i: 25(f)
	o: 63()

nname: 34
n 34(None)[msg_template = _('Device "%(name)s" plugged in.')
]:
	i: 25(t)
	o: 63()

nname: 25
n 25(plugged)[name = obj.get('title')
]:
	i: 0(t), 15()
	o: 34(t), 50(f)

nname: 15
n 15(None)[]:
	i: 0(f)
	o: 25()

nname: 0
n 0(obj.get('title'))[]:
	i: 
	o: 15(f), 25(t)

nname: 657
n 657(None)[return None
]:
	i: 588(t), 621(JA), 570(f), 348&369(f)
	o: 

nname: 621
n 621(None)[log.debug('calling build_preview()')
nav.build_preview()
]:
	i: 588(f)
	o: 657(JA)

nname: 588
n 588(nav._history)[log.debug('calling _refresh_root()')
nav._refresh_root()
]:
	i: 570(t)
	o: 621(f), 657(t)

nname: 570
n 570(stack.get_navigator() is nav)[]:
	i: 555(), 382(t)
	o: 588(t), 657(f)

nname: 555
n 555(None)[nav._update_marker()
]:
	i: 529()
	o: 570()

nname: 529
n 529(None)[for mlist in markerlists():
	mlist._refresh()
]:
	i: 466(loop)
	o: 555()

nname: 466
n 466(None)[if concerned:
	stack.close_player()
	stack.back_to_menu(nav)
	nav.back_to_root()
from pygui.markerlist import markerlists
]:
	i: 389(AL), 399(AF), 409&422(f)
	o: 529(loop)

nname: 409&422
n 409&422(None)[for h in nav._history:
if h['selected'] and h['selected'].wymedia_resource['id'] == obj['id']:
	concerned = True
	break
	continue
]:
	i: 399(for)
	o: 466()

nname: 399
n 399(None)[]:
	i: 389(loop)
	o: 409&422(for), 466(AF)

nname: 389
n 389(None)[concerned = False
]:
	i: 382(f)
	o: 399(loop), 466(AL)

nname: 382
n 382(plugged)[]:
	i: 348&369(t)
	o: 389(f), 570(t)

nname: 348&369
n 348&369(nav is not None and nav in stack)[nav = self._navigator
]:
	i: 238&250()
	o: 382(t), 657(f)

nname: 238&250
n 238&250(None)[if not('popup_blocker' in plugins and stack.get_player()):
	MessageWindow(msg, button=None).show(timeout=3)
if 'transcode' in plugins and name.startswith('"PSP"'):
	pygui_globs['psp_path'] = obj.get('uri')
]:
	i: 220(JA), 234(), 63(f)
	o: 348&369()

nname: 220
n 220(None)[except:
	PRINT_EXCEPTION()
]:
	i: 199()
	o: 238&250(JA)

nname: 199
n 199(None)[try:
	UpdateManager().unplug_update()
]:
	i: 63(t)
	o: 220()

nname: 63
n 63(obj.get('backend', '') != 'upnp')[msg = msg_template % {'name': name}
log.debug('%s / %s', msg, name)
stack = pygui_globs['menustack']
if plugged:
	if 'WYDEMO' in obj['title'].upper():
		from pygui.facilities.demomode import handle_demo
		handle_demo(obj)
]:
	i: 0()
	o: 199(t), 238&250(f)

nname: 0
n 0(None)[if not obj.get('title'):
	pass
name = obj.get('title')
if plugged:
	msg_template = _('Device "%(name)s" plugged in.')
else:
	msg_template = _('Device "%(name)s" removed.')
]:
	i: 
	o: 63()

nname: 657
n 657(None)[return None
]:
	i: 570(f), 238&250(f)
	o: 

nname: 570
n 570(None)[if stack.get_navigator() is nav:
	log.debug('calling _refresh_root()')
	nav._refresh_root()
	if not nav._history:
		log.debug('calling build_preview()')
		nav.build_preview()
]:
	i: 555(), 382(t)
	o: 657(JA)

nname: 555
n 555(None)[nav._update_marker()
]:
	i: 409&422()
	o: 570()

nname: 409&422
n 409&422(None)[for h in nav._history:
	if h['selected'] and h['selected'].wymedia_resource['id'] == obj['id']:
		concerned = True
		break
		continue
if concerned:
	stack.close_player()
	stack.back_to_menu(nav)
	nav.back_to_root()
from pygui.markerlist import markerlists
for mlist in markerlists():
	mlist._refresh()
]:
	i: 389(for)
	o: 555()

nname: 389
n 389(None)[concerned = False
]:
	i: 382(f)
	o: 409&422(for)

nname: 382
n 382(plugged)[]:
	i: 238&250(t)
	o: 389(f), 570(t)

nname: 238&250
n 238&250(nav is not None and nav in stack)[if not('popup_blocker' in plugins and stack.get_player()):
	MessageWindow(msg, button=None).show(timeout=3)
if 'transcode' in plugins and name.startswith('"PSP"'):
	pygui_globs['psp_path'] = obj.get('uri')
nav = self._navigator
]:
	i: 199(JA), 234(), 0(f)
	o: 382(t), 657(f)

nname: 199
n 199(None)[try:
	UpdateManager().unplug_update()
except:
	PRINT_EXCEPTION()
]:
	i: 0(t)
	o: 238&250(JA)

nname: 0
n 0(obj.get('backend', '') != 'upnp')[if not obj.get('title'):
	pass
name = obj.get('title')
if plugged:
	msg_template = _('Device "%(name)s" plugged in.')
else:
	msg_template = _('Device "%(name)s" removed.')
msg = msg_template % {'name': name}
log.debug('%s / %s', msg, name)
stack = pygui_globs['menustack']
if plugged:
	if 'WYDEMO' in obj['title'].upper():
		from pygui.facilities.demomode import handle_demo
		handle_demo(obj)
]:
	i: 
	o: 199(t), 238&250(f)

nname: 657
n 657(None)[return None
]:
	i: 570(f), 238&250(f)
	o: 

nname: 570
n 570(None)[if stack.get_navigator() is nav:
	log.debug('calling _refresh_root()')
	nav._refresh_root()
	if not nav._history:
		log.debug('calling build_preview()')
		nav.build_preview()
]:
	i: 555(), 382(t)
	o: 657(JA)

nname: 555
n 555(None)[nav._update_marker()
]:
	i: 389()
	o: 570()

nname: 389
n 389(None)[concerned = False
for h in nav._history:
	if h['selected'] and h['selected'].wymedia_resource['id'] == obj['id']:
		concerned = True
		break
		continue
if concerned:
	stack.close_player()
	stack.back_to_menu(nav)
	nav.back_to_root()
from pygui.markerlist import markerlists
for mlist in markerlists():
	mlist._refresh()
]:
	i: 382(f)
	o: 555()

nname: 382
n 382(plugged)[]:
	i: 238&250(t)
	o: 389(f), 570(t)

nname: 238&250
n 238&250(nav is not None and nav in stack)[if not('popup_blocker' in plugins and stack.get_player()):
	MessageWindow(msg, button=None).show(timeout=3)
if 'transcode' in plugins and name.startswith('"PSP"'):
	pygui_globs['psp_path'] = obj.get('uri')
nav = self._navigator
]:
	i: 234(), 0(f)
	o: 382(t), 657(f)

nname: 0
n 0(None)[if not obj.get('title'):
	pass
name = obj.get('title')
if plugged:
	msg_template = _('Device "%(name)s" plugged in.')
else:
	msg_template = _('Device "%(name)s" removed.')
msg = msg_template % {'name': name}
log.debug('%s / %s', msg, name)
stack = pygui_globs['menustack']
if plugged:
	if 'WYDEMO' in obj['title'].upper():
		from pygui.facilities.demomode import handle_demo
		handle_demo(obj)
if obj.get('backend', '') != 'upnp':
	try:
		UpdateManager().unplug_update()
	except:
		PRINT_EXCEPTION()
]:
	i: 
	o: 238&250(JA)

nname: 657
n 657(None)[return None
]:
	i: 570(f), 238&250(f)
	o: 

nname: 570
n 570(None)[if stack.get_navigator() is nav:
	log.debug('calling _refresh_root()')
	nav._refresh_root()
	if not nav._history:
		log.debug('calling build_preview()')
		nav.build_preview()
]:
	i: 389(), 382(t)
	o: 657(JA)

nname: 389
n 389(None)[concerned = False
for h in nav._history:
	if h['selected'] and h['selected'].wymedia_resource['id'] == obj['id']:
		concerned = True
		break
		continue
if concerned:
	stack.close_player()
	stack.back_to_menu(nav)
	nav.back_to_root()
from pygui.markerlist import markerlists
for mlist in markerlists():
	mlist._refresh()
nav._update_marker()
]:
	i: 382(f)
	o: 570()

nname: 382
n 382(plugged)[]:
	i: 238&250(t)
	o: 389(f), 570(t)

nname: 238&250
n 238&250(nav is not None and nav in stack)[if not('popup_blocker' in plugins and stack.get_player()):
	MessageWindow(msg, button=None).show(timeout=3)
if 'transcode' in plugins and name.startswith('"PSP"'):
	pygui_globs['psp_path'] = obj.get('uri')
nav = self._navigator
]:
	i: 234(), 0(f)
	o: 382(t), 657(f)

nname: 0
n 0(None)[if not obj.get('title'):
	pass
name = obj.get('title')
if plugged:
	msg_template = _('Device "%(name)s" plugged in.')
else:
	msg_template = _('Device "%(name)s" removed.')
msg = msg_template % {'name': name}
log.debug('%s / %s', msg, name)
stack = pygui_globs['menustack']
if plugged:
	if 'WYDEMO' in obj['title'].upper():
		from pygui.facilities.demomode import handle_demo
		handle_demo(obj)
if obj.get('backend', '') != 'upnp':
	try:
		UpdateManager().unplug_update()
	except:
		PRINT_EXCEPTION()
]:
	i: 
	o: 238&250(JA)

nname: 657
n 657(None)[return None
]:
	i: 382(f), 238&250(f)
	o: 

nname: 382
n 382(None)[if not plugged:
	concerned = False
	for h in nav._history:
		if h['selected'] and h['selected'].wymedia_resource['id'] == obj['id']:
			concerned = True
			break
			continue
	if concerned:
		stack.close_player()
		stack.back_to_menu(nav)
		nav.back_to_root()
	from pygui.markerlist import markerlists
	for mlist in markerlists():
		mlist._refresh()
	nav._update_marker()
if stack.get_navigator() is nav:
	log.debug('calling _refresh_root()')
	nav._refresh_root()
	if not nav._history:
		log.debug('calling build_preview()')
		nav.build_preview()
]:
	i: 238&250(t)
	o: 657(JA)

nname: 238&250
n 238&250(nav is not None and nav in stack)[if not('popup_blocker' in plugins and stack.get_player()):
	MessageWindow(msg, button=None).show(timeout=3)
if 'transcode' in plugins and name.startswith('"PSP"'):
	pygui_globs['psp_path'] = obj.get('uri')
nav = self._navigator
]:
	i: 234(), 0(f)
	o: 382(t), 657(f)

nname: 0
n 0(None)[if not obj.get('title'):
	pass
name = obj.get('title')
if plugged:
	msg_template = _('Device "%(name)s" plugged in.')
else:
	msg_template = _('Device "%(name)s" removed.')
msg = msg_template % {'name': name}
log.debug('%s / %s', msg, name)
stack = pygui_globs['menustack']
if plugged:
	if 'WYDEMO' in obj['title'].upper():
		from pygui.facilities.demomode import handle_demo
		handle_demo(obj)
if obj.get('backend', '') != 'upnp':
	try:
		UpdateManager().unplug_update()
	except:
		PRINT_EXCEPTION()
]:
	i: 
	o: 238&250(JA)

nname: 238&250
n 238&250(None)[if not('popup_blocker' in plugins and stack.get_player()):
	MessageWindow(msg, button=None).show(timeout=3)
if 'transcode' in plugins and name.startswith('"PSP"'):
	pygui_globs['psp_path'] = obj.get('uri')
nav = self._navigator
if nav is not None and nav in stack:
	if not plugged:
		concerned = False
		for h in nav._history:
			if h['selected'] and h['selected'].wymedia_resource['id'] == obj['id']:
				concerned = True
				break
				continue
		if concerned:
			stack.close_player()
			stack.back_to_menu(nav)
			nav.back_to_root()
		from pygui.markerlist import markerlists
		for mlist in markerlists():
			mlist._refresh()
		nav._update_marker()
	if stack.get_navigator() is nav:
		log.debug('calling _refresh_root()')
		nav._refresh_root()
		if not nav._history:
			log.debug('calling build_preview()')
			nav.build_preview()
return None
]:
	i: 234(), 0(f)
	o: 

nname: 0
n 0(None)[if not obj.get('title'):
	pass
name = obj.get('title')
if plugged:
	msg_template = _('Device "%(name)s" plugged in.')
else:
	msg_template = _('Device "%(name)s" removed.')
msg = msg_template % {'name': name}
log.debug('%s / %s', msg, name)
stack = pygui_globs['menustack']
if plugged:
	if 'WYDEMO' in obj['title'].upper():
		from pygui.facilities.demomode import handle_demo
		handle_demo(obj)
if obj.get('backend', '') != 'upnp':
	try:
		UpdateManager().unplug_update()
	except:
		PRINT_EXCEPTION()
]:
	i: 
	o: 238&250(JA)

self.nodes: {0: <unpyclib.structure.node instance at 0xb76958ec>, '238&250': <unpyclib.structure.node instance at 0xb769592c>, 233: <unpyclib.structure.node instance at 0xb76a876c>, 234: <unpyclib.structure.node instance at 0xb76a87ec>}
nname: 0
n 0(None)[from .parameters import MainSetupParametersNotebookMenu
from pygui.item.parameters.generalsetup import GeneralConfigurationItem
user_config['security']['parent_mode'] = True
user_config.save()
sm = MainSetupParametersNotebookMenu(name=_('Parameters'), type='notebook_setup_parameters', universe='parameters')
sm.show(sub_to_show=GeneralConfigurationItem)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb769560c>}
nname: 0
n 0(None)[from pygui.menu.menu.security import QuestionAnswerCheckLauncher
QuestionAnswerCheckLauncher(_display_setup)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb769532c>}
nname: 132
n 132(None)[]:
	i: 54(), 65()
	o: 

nname: 65
n 65(None)[from .parameters import SecretCodeCheckMenu
sc = SecretCodeCheckMenu(name=_('Check PIN Code'), action=_display_setup, cancel_action=_display_qa)
pygui_globs['menustack'].push_menu(sc)
]:
	i: 0&38(f)
	o: 132()

nname: 54
n 54(None)[_display_setup()
]:
	i: 0&38(t)
	o: 132()

nname: 0&38
n 0&38(user_config['security']['parent_mode'] or not user_config['security']['parental_control'])[def _display_setup():
	from .parameters import MainSetupParametersNotebookMenu
	from pygui.item.parameters.generalsetup import GeneralConfigurationItem
	user_config['security']['parent_mode'] = True
	user_config.save()
	sm = MainSetupParametersNotebookMenu(name=_('Parameters'), type='notebook_setup_parameters', universe='parameters')
	sm.show(sub_to_show=GeneralConfigurationItem)

def _display_qa():
	from pygui.menu.menu.security import QuestionAnswerCheckLauncher
	QuestionAnswerCheckLauncher(_display_setup)

]:
	i: 
	o: 54(t), 65(f)

nname: 0&38
n 0&38(None)[def _display_setup():
	from .parameters import MainSetupParametersNotebookMenu
	from pygui.item.parameters.generalsetup import GeneralConfigurationItem
	user_config['security']['parent_mode'] = True
	user_config.save()
	sm = MainSetupParametersNotebookMenu(name=_('Parameters'), type='notebook_setup_parameters', universe='parameters')
	sm.show(sub_to_show=GeneralConfigurationItem)

def _display_qa():
	from pygui.menu.menu.security import QuestionAnswerCheckLauncher
	QuestionAnswerCheckLauncher(_display_setup)

if user_config['security']['parent_mode'] or not user_config['security']['parental_control']:
	_display_setup()
else:
	from .parameters import SecretCodeCheckMenu
	sc = SecretCodeCheckMenu(name=_('Check PIN Code'), action=_display_setup, cancel_action=_display_qa)
	pygui_globs['menustack'].push_menu(sc)
]:
	i: 
	o: 

self.nodes: {'0&38': <unpyclib.structure.node instance at 0xb7690aec>}
nname: 0
n 0(None)[from pygui.item.parameters.tv.tvsetup import TNTAutomaticScanItem
item = TNTAutomaticScanItem(parent=None, name=_('Automatic scan'), type_='setupitem')
item.menu = self
item.execute()
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7695dac>}
nname: 93
n 93(None)[messbox = ConfirmWindow(text=_('Do you want to launch a scan now?'), buttons=buttons)
messbox.show()
]:
	i: 65(), 92()
	o: 

nname: 92
n 92(None)[]:
	i: 0(f)
	o: 93()

nname: 65
n 65(None)[buttons[1].connect(ChannelItem.player.play)
]:
	i: 0(t)
	o: 93()

nname: 0
n 0(play_on_no)[buttons = [Button(_('Yes'), True), Button(_('No'), False)]
buttons[0].connect(_fullscan)
]:
	i: 
	o: 65(t), 92(f)

nname: 0
n 0(None)[buttons = [Button(_('Yes'), True), Button(_('No'), False)]
buttons[0].connect(_fullscan)
if play_on_no:
	buttons[1].connect(ChannelItem.player.play)
messbox = ConfirmWindow(text=_('Do you want to launch a scan now?'), buttons=buttons)
messbox.show()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb769b22c>}
nname: 267
n 267(None)[]:
	i: 188(), 236(), 253()
	o: 

nname: 253
n 253(None)[ChannelItem.player.play()
]:
	i: 199&212(f)
	o: 267()

nname: 236
n 236(None)[prompt_tv_scan(play_on_no=True)
]:
	i: 199&212(t)
	o: 267()

nname: 199&212
n 199&212(num_channels == 1 and channels[0]['class'].endswith('videoCapture'))[]:
	i: 152(f)
	o: 236(t), 253(f)

nname: 188
n 188(None)[_fullscan()
]:
	i: 152(t)
	o: 267()

nname: 152
n 152(num_channels == 0)[user_config['advanced']['last_universe'] = 'tv'
user_config.save()
]:
	i: 36(), 85(), 151(AE)
	o: 188(t), 199&212(f)

nname: 85
n 85(None)[w = MessageWindow(text=_('Channels are unavailable. Please try again.\nIf the problem persists, launch a scan or reset to factory defaults.'), title=_('TV failure'))
w.show(timeout=3)
PRINT_EXCEPTION()
]:
	i: 0(except)
	o: 152()

nname: 36
n 36(None)[acl = TVRootItem().get_acl(menu=self)
channels = acl.browse()
num_channels = len(channels)
]:
	i: 0(try)
	o: 152()

nname: 0
n 0(None)[def _fullscan():
	from pygui.item.parameters.tv.tvsetup import TNTAutomaticScanItem
	item = TNTAutomaticScanItem(parent=None, name=_('Automatic scan'), type_='setupitem')
	item.menu = self
	item.execute()
	return None

def prompt_tv_scan(play_on_no=False):
	buttons = [Button(_('Yes'), True), Button(_('No'), False)]
	buttons[0].connect(_fullscan)
	if play_on_no:
		buttons[1].connect(ChannelItem.player.play)
	messbox = ConfirmWindow(text=_('Do you want to launch a scan now?'), buttons=buttons)
	messbox.show()

]:
	i: 
	o: 36(try), 85(except)

nname: 267
n 267(None)[]:
	i: 85()
	o: 

nname: 85
n 85(None)[except:
	w = MessageWindow(text=_('Channels are unavailable. Please try again.\nIf the problem persists, launch a scan or reset to factory defaults.'), title=_('TV failure'))
	w.show(timeout=3)
	PRINT_EXCEPTION()
user_config['advanced']['last_universe'] = 'tv'
user_config.save()
if num_channels == 0:
	_fullscan()
else:
	if num_channels == 1 and channels[0]['class'].endswith('videoCapture'):
		prompt_tv_scan(play_on_no=True)
	else:
		ChannelItem.player.play()
]:
	i: 0()
	o: 267()

nname: 0
n 0(None)[def _fullscan():
	from pygui.item.parameters.tv.tvsetup import TNTAutomaticScanItem
	item = TNTAutomaticScanItem(parent=None, name=_('Automatic scan'), type_='setupitem')
	item.menu = self
	item.execute()
	return None

def prompt_tv_scan(play_on_no=False):
	buttons = [Button(_('Yes'), True), Button(_('No'), False)]
	buttons[0].connect(_fullscan)
	if play_on_no:
		buttons[1].connect(ChannelItem.player.play)
	messbox = ConfirmWindow(text=_('Do you want to launch a scan now?'), buttons=buttons)
	messbox.show()

try:
	acl = TVRootItem().get_acl(menu=self)
	channels = acl.browse()
	num_channels = len(channels)
]:
	i: 
	o: 85()

nname: 267
n 267(None)[]:
	i: 0()
	o: 

nname: 0
n 0(None)[def _fullscan():
	from pygui.item.parameters.tv.tvsetup import TNTAutomaticScanItem
	item = TNTAutomaticScanItem(parent=None, name=_('Automatic scan'), type_='setupitem')
	item.menu = self
	item.execute()
	return None

def prompt_tv_scan(play_on_no=False):
	buttons = [Button(_('Yes'), True), Button(_('No'), False)]
	buttons[0].connect(_fullscan)
	if play_on_no:
		buttons[1].connect(ChannelItem.player.play)
	messbox = ConfirmWindow(text=_('Do you want to launch a scan now?'), buttons=buttons)
	messbox.show()

try:
	acl = TVRootItem().get_acl(menu=self)
	channels = acl.browse()
	num_channels = len(channels)
except:
	w = MessageWindow(text=_('Channels are unavailable. Please try again.\nIf the problem persists, launch a scan or reset to factory defaults.'), title=_('TV failure'))
	w.show(timeout=3)
	PRINT_EXCEPTION()
user_config['advanced']['last_universe'] = 'tv'
user_config.save()
if num_channels == 0:
	_fullscan()
else:
	if num_channels == 1 and channels[0]['class'].endswith('videoCapture'):
		prompt_tv_scan(play_on_no=True)
	else:
		ChannelItem.player.play()
]:
	i: 
	o: 267()

nname: 0
n 0(None)[def _fullscan():
	from pygui.item.parameters.tv.tvsetup import TNTAutomaticScanItem
	item = TNTAutomaticScanItem(parent=None, name=_('Automatic scan'), type_='setupitem')
	item.menu = self
	item.execute()
	return None

def prompt_tv_scan(play_on_no=False):
	buttons = [Button(_('Yes'), True), Button(_('No'), False)]
	buttons[0].connect(_fullscan)
	if play_on_no:
		buttons[1].connect(ChannelItem.player.play)
	messbox = ConfirmWindow(text=_('Do you want to launch a scan now?'), buttons=buttons)
	messbox.show()

try:
	acl = TVRootItem().get_acl(menu=self)
	channels = acl.browse()
	num_channels = len(channels)
except:
	w = MessageWindow(text=_('Channels are unavailable. Please try again.\nIf the problem persists, launch a scan or reset to factory defaults.'), title=_('TV failure'))
	w.show(timeout=3)
	PRINT_EXCEPTION()
user_config['advanced']['last_universe'] = 'tv'
user_config.save()
if num_channels == 0:
	_fullscan()
else:
	if num_channels == 1 and channels[0]['class'].endswith('videoCapture'):
		prompt_tv_scan(play_on_no=True)
	else:
		ChannelItem.player.play()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76950ac>}
nname: 411
n 411(None)[return None
]:
	i: 43(), 374()
	o: 

nname: 374
n 374(None)[self._navigator.show()
user_config['advanced']['last_universe'] = name
user_config.save()
]:
	i: 298(), 345()
	o: 411()

nname: 345
n 345(None)[self._navigator.reset(name, type=name, universe=name)
]:
	i: 283(f)
	o: 374()

nname: 298
n 298(None)[from pygui.menu.menu import Navigator
self._navigator = Navigator(name, name, [], type=name)
]:
	i: 283(t)
	o: 374()

nname: 283
n 283(self._navigator is None)[]:
	i: 239(), 282()
	o: 298(t), 345(f)

nname: 282
n 282(None)[]:
	i: 94(f)
	o: 283()

nname: 239
n 239(None)[lang = user_config['base']['language']
log.info("'lang' param set for net services'")
set_param('lang', lang)
]:
	i: 208(), 238()
	o: 283()

nname: 238
n 238(None)[]:
	i: 196(f)
	o: 239()

nname: 208
n 208(None)[log.info("'pass' param set for net services'")
set_param('pass', password)
]:
	i: 196(t)
	o: 239()

nname: 196
n 196(password is not None)[]:
	i: 165(), 195()
	o: 208(t), 238(f)

nname: 195
n 195(None)[]:
	i: 107(f)
	o: 196()

nname: 165
n 165(None)[log.info("'user' param set for net services'")
set_param('user', login)
]:
	i: 107(t)
	o: 196()

nname: 107
n 107(login is not None)[from wymedia.wmplus import set_param
login, password = user_config['net']['login'], user_config['net']['password']
]:
	i: 94(t)
	o: 165(t), 195(f)

nname: 94
n 94(name == 'net_services')[]:
	i: 0(f)
	o: 107(t), 282(f)

nname: 43
n 43(None)[stack.back_to_home()
MessageWindow(text='Please configure connection', title='Not connected', button=False).show(timeout=5)
]:
	i: 0(t)
	o: 411()

nname: 0
n 0(NM.get_state() == 'disconnected')[from peewee.networkmanager import NetworkManager
NM = NetworkManager()
]:
	i: 
	o: 43(t), 94(f)

nname: 411
n 411(None)[return None
]:
	i: 43(), 283()
	o: 

nname: 283
n 283(None)[if self._navigator is None:
	from pygui.menu.menu import Navigator
	self._navigator = Navigator(name, name, [], type=name)
else:
	self._navigator.reset(name, type=name, universe=name)
self._navigator.show()
user_config['advanced']['last_universe'] = name
user_config.save()
]:
	i: 239(), 94(f)
	o: 411()

nname: 239
n 239(None)[lang = user_config['base']['language']
log.info("'lang' param set for net services'")
set_param('lang', lang)
]:
	i: 107()
	o: 283()

nname: 107
n 107(None)[from wymedia.wmplus import set_param
login, password = user_config['net']['login'], user_config['net']['password']
if login is not None:
	log.info("'user' param set for net services'")
	set_param('user', login)
if password is not None:
	log.info("'pass' param set for net services'")
	set_param('pass', password)
]:
	i: 94(t)
	o: 239()

nname: 94
n 94(name == 'net_services')[]:
	i: 0(f)
	o: 107(t), 283(f)

nname: 43
n 43(None)[stack.back_to_home()
MessageWindow(text='Please configure connection', title='Not connected', button=False).show(timeout=5)
]:
	i: 0(t)
	o: 411()

nname: 0
n 0(NM.get_state() == 'disconnected')[from peewee.networkmanager import NetworkManager
NM = NetworkManager()
]:
	i: 
	o: 43(t), 94(f)

nname: 411
n 411(None)[return None
]:
	i: 43(), 283()
	o: 

nname: 283
n 283(None)[if self._navigator is None:
	from pygui.menu.menu import Navigator
	self._navigator = Navigator(name, name, [], type=name)
else:
	self._navigator.reset(name, type=name, universe=name)
self._navigator.show()
user_config['advanced']['last_universe'] = name
user_config.save()
]:
	i: 107(), 94(f)
	o: 411()

nname: 107
n 107(None)[from wymedia.wmplus import set_param
login, password = user_config['net']['login'], user_config['net']['password']
if login is not None:
	log.info("'user' param set for net services'")
	set_param('user', login)
if password is not None:
	log.info("'pass' param set for net services'")
	set_param('pass', password)
lang = user_config['base']['language']
log.info("'lang' param set for net services'")
set_param('lang', lang)
]:
	i: 94(t)
	o: 283()

nname: 94
n 94(name == 'net_services')[]:
	i: 0(f)
	o: 107(t), 283(f)

nname: 43
n 43(None)[stack.back_to_home()
MessageWindow(text='Please configure connection', title='Not connected', button=False).show(timeout=5)
]:
	i: 0(t)
	o: 411()

nname: 0
n 0(NM.get_state() == 'disconnected')[from peewee.networkmanager import NetworkManager
NM = NetworkManager()
]:
	i: 
	o: 43(t), 94(f)

nname: 411
n 411(None)[return None
]:
	i: 43(), 94()
	o: 

nname: 94
n 94(None)[if name == 'net_services':
	from wymedia.wmplus import set_param
	login, password = user_config['net']['login'], user_config['net']['password']
	if login is not None:
		log.info("'user' param set for net services'")
		set_param('user', login)
	if password is not None:
		log.info("'pass' param set for net services'")
		set_param('pass', password)
	lang = user_config['base']['language']
	log.info("'lang' param set for net services'")
	set_param('lang', lang)
if self._navigator is None:
	from pygui.menu.menu import Navigator
	self._navigator = Navigator(name, name, [], type=name)
else:
	self._navigator.reset(name, type=name, universe=name)
self._navigator.show()
user_config['advanced']['last_universe'] = name
user_config.save()
]:
	i: 0(f)
	o: 411()

nname: 43
n 43(None)[stack.back_to_home()
MessageWindow(text='Please configure connection', title='Not connected', button=False).show(timeout=5)
]:
	i: 0(t)
	o: 411()

nname: 0
n 0(NM.get_state() == 'disconnected')[from peewee.networkmanager import NetworkManager
NM = NetworkManager()
]:
	i: 
	o: 43(t), 94(f)

nname: 0
n 0(None)[from peewee.networkmanager import NetworkManager
NM = NetworkManager()
if NM.get_state() == 'disconnected':
	stack.back_to_home()
	MessageWindow(text='Please configure connection', title='Not connected', button=False).show(timeout=5)
else:
	if name == 'net_services':
		from wymedia.wmplus import set_param
		login, password = user_config['net']['login'], user_config['net']['password']
		if login is not None:
			log.info("'user' param set for net services'")
			set_param('user', login)
		if password is not None:
			log.info("'pass' param set for net services'")
			set_param('pass', password)
		lang = user_config['base']['language']
		log.info("'lang' param set for net services'")
		set_param('lang', lang)
	if self._navigator is None:
		from pygui.menu.menu import Navigator
		self._navigator = Navigator(name, name, [], type=name)
	else:
		self._navigator.reset(name, type=name, universe=name)
	self._navigator.show()
	user_config['advanced']['last_universe'] = name
	user_config.save()
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb769bbec>}
nname: 91
n 91(None)[self._navigator.show()
user_config['advanced']['last_universe'] = name
user_config.save()
return None
]:
	i: 15(), 62()
	o: 

nname: 62
n 62(None)[self._navigator.reset(name, type=name, universe=name)
]:
	i: 0(f)
	o: 91()

nname: 15
n 15(None)[from pygui.menu.menu import Navigator
self._navigator = Navigator(name, name, [], type=name)
]:
	i: 0(t)
	o: 91()

nname: 0
n 0(self._navigator is None)[]:
	i: 
	o: 15(t), 62(f)

nname: 0
n 0(None)[if self._navigator is None:
	from pygui.menu.menu import Navigator
	self._navigator = Navigator(name, name, [], type=name)
else:
	self._navigator.reset(name, type=name, universe=name)
self._navigator.show()
user_config['advanced']['last_universe'] = name
user_config.save()
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76fba4c>}
nname: 0
n 0(None)[from pygui.item.web import URLItem
URLItem.player.play(url)
user_config['advanced']['last_universe'] = 'web'
user_config.save()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76fb68c>}
nname: 0
n 0(None)[from pygui.menu.menu.test_menu import GenMenu
GenMenu().show()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76fb92c>}
nname: 0
n 0(None)[from .bsod import BSoDMenu
hdmi_menu = BSoDMenu()
pygui_globs['menustack'].push_menu(hdmi_menu)
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76fbacc>}
nname: 0
n 0(None)[from pygui.menu.menu import FailsafeMenu
FailsafeMenu().show()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76fb54c>}
nname: 6
n 6(None)[__doc__ = "\n    The Root Menu is a menu always present in the stack.\n    He is not supposed to have a specific view, nor specific features.\n    It's the base menu, used to register all the global callbacks\n    "
def __init__(self):
	self.eventHandler = EventDispatcher(self)
	self._navigator = None
	Menu.__init__(self, 'root', type='root')
	def self._getitems_keywords['message']():
		return _('Press Home to switch universe')

	import wymedia.wmplus as w
	w.register_plug_callback((lambda obj: Task(self.device_plugged, obj, True).start(0)))
	w.register_unplug_callback((lambda obj: Task(self.device_plugged, obj, False).start(0)))
	from peewee.controlmode import ControlModeManager
	ctrl = ControlModeManager()
	ctrl.register_observer(self.control_changed)
	pygui_globs['controlmodemanager'] = ctrl
	self._controlmode_popup = None
	self.active_univ = None
	return None

def show(self, hide_previous_menu=True, timeout=None):
	Menu.show(self, hide_previous_menu, timeout)
	if 'restore_last_universe' in plugins and not user_config['advanced']['last_universe']:
		louie_send('show_select_universe', sender=self)

def control_changed(self, mode, rcu, standby):
	from peewee.notifier import events_drop
	from pygui.facilities.power import PowerManager
	from pygui.menu.menu.bsod import BSoDMenu
	log.debug('Control changed: mode=%s rcu=%s standby=%s', mode, rcu, standby)
	msg = control_mode_popup_dict[mode]
	if rcu:
		if self._controlmode_popup:
			self._controlmode_popup.hide()
			self._controlmode_popup = None
		events_drop(False)
		plugins.discard('popup_blocker')
		stack = pygui_globs['menustack']
		if not stack.is_on_firstboot():
			stack.back_to_home()
		MessageWindow(msg, button=None).show(timeout=3)
	else:
		events_drop(True)
		plugins.add('popup_blocker')
		stack = pygui_globs['menustack']
		if not stack.is_on_firstboot():
			stack.back_to_home()
			BSoDMenu().show()
		self._controlmode_popup = MessageWindow(msg, button=None)
		self._controlmode_popup.show()
	return None

def device_plugged(self, obj, plugged):
	if not obj.get('title'):
		pass
	name = obj.get('title')
	if plugged:
		msg_template = _('Device "%(name)s" plugged in.')
	else:
		msg_template = _('Device "%(name)s" removed.')
	msg = msg_template % {'name': name}
	log.debug('%s / %s', msg, name)
	stack = pygui_globs['menustack']
	if plugged:
		if 'WYDEMO' in obj['title'].upper():
			from pygui.facilities.demomode import handle_demo
			handle_demo(obj)
	if obj.get('backend', '') != 'upnp':
		try:
			UpdateManager().unplug_update()
		except:
			PRINT_EXCEPTION()

def launch_parameters(self):
	def _display_setup():
		from .parameters import MainSetupParametersNotebookMenu
		from pygui.item.parameters.generalsetup import GeneralConfigurationItem
		user_config['security']['parent_mode'] = True
		user_config.save()
		sm = MainSetupParametersNotebookMenu(name=_('Parameters'), type='notebook_setup_parameters', universe='parameters')
		sm.show(sub_to_show=GeneralConfigurationItem)

	def _display_qa():
		from pygui.menu.menu.security import QuestionAnswerCheckLauncher
		QuestionAnswerCheckLauncher(_display_setup)

	if user_config['security']['parent_mode'] or not user_config['security']['parental_control']:
		_display_setup()
	else:
		from .parameters import SecretCodeCheckMenu
		sc = SecretCodeCheckMenu(name=_('Check PIN Code'), action=_display_setup, cancel_action=_display_qa)
		pygui_globs['menustack'].push_menu(sc)

def launch_tv(self):
	def _fullscan():
		from pygui.item.parameters.tv.tvsetup import TNTAutomaticScanItem
		item = TNTAutomaticScanItem(parent=None, name=_('Automatic scan'), type_='setupitem')
		item.menu = self
		item.execute()
		return None

	def prompt_tv_scan(play_on_no=False):
		buttons = [Button(_('Yes'), True), Button(_('No'), False)]
		buttons[0].connect(_fullscan)
		if play_on_no:
			buttons[1].connect(ChannelItem.player.play)
		messbox = ConfirmWindow(text=_('Do you want to launch a scan now?'), buttons=buttons)
		messbox.show()

	try:
		acl = TVRootItem().get_acl(menu=self)
		channels = acl.browse()
		num_channels = len(channels)
	except:
		w = MessageWindow(text=_('Channels are unavailable. Please try again.\nIf the problem persists, launch a scan or reset to factory defaults.'), title=_('TV failure'))
		w.show(timeout=3)
		PRINT_EXCEPTION()
	user_config['advanced']['last_universe'] = 'tv'
	user_config.save()
	if num_channels == 0:
		_fullscan()
	else:
		if num_channels == 1 and channels[0]['class'].endswith('videoCapture'):
			prompt_tv_scan(play_on_no=True)
		else:
			ChannelItem.player.play()

def launch_net_services(self, name):
	from peewee.networkmanager import NetworkManager
	NM = NetworkManager()
	if NM.get_state() == 'disconnected':
		stack.back_to_home()
		MessageWindow(text='Please configure connection', title='Not connected', button=False).show(timeout=5)
	else:
		if name == 'net_services':
			from wymedia.wmplus import set_param
			login, password = user_config['net']['login'], user_config['net']['password']
			if login is not None:
				log.info("'user' param set for net services'")
				set_param('user', login)
			if password is not None:
				log.info("'pass' param set for net services'")
				set_param('pass', password)
			lang = user_config['base']['language']
			log.info("'lang' param set for net services'")
			set_param('lang', lang)
		if self._navigator is None:
			from pygui.menu.menu import Navigator
			self._navigator = Navigator(name, name, [], type=name)
		else:
			self._navigator.reset(name, type=name, universe=name)
		self._navigator.show()
		user_config['advanced']['last_universe'] = name
		user_config.save()
	return None

def launch_navigator(self, name):
	if self._navigator is None:
		from pygui.menu.menu import Navigator
		self._navigator = Navigator(name, name, [], type=name)
	else:
		self._navigator.reset(name, type=name, universe=name)
	self._navigator.show()
	user_config['advanced']['last_universe'] = name
	user_config.save()
	return None

launch_multiverse, launch_audio, launch_video, launch_video_image, launch_image = launch_navigator, launch_navigator, launch_navigator, launch_navigator, launch_navigator
def launch_web(self):
	from pygui.item.web import URLItem
	URLItem.player.play(url)
	user_config['advanced']['last_universe'] = 'web'
	user_config.save()

def launch_testmenu(self):
	from pygui.menu.menu.test_menu import GenMenu
	GenMenu().show()

def launch_hdmi(self):
	from .bsod import BSoDMenu
	hdmi_menu = BSoDMenu()
	pygui_globs['menustack'].push_menu(hdmi_menu)

launch_hdmi_tv_1, launch_hdmi_tv_2, launch_hdmi_tv = launch_hdmi, launch_hdmi, launch_hdmi
def launch_failsafe(self):
	from pygui.menu.menu import FailsafeMenu
	FailsafeMenu().show()

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb76fbecc>}
nname: 25
n 25(None)[return self.selected
]:
	i: 0(f), 9()
	o: 

nname: 9
n 9(None)[]:
	i: 0(t)
	o: 25()

nname: 0
n 0(self.selected)[]:
	i: 
	o: 9(t), 25(f)

nname: 0
n 0(None)[if self.selected:
	pass
return self.selected
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7690f6c>}
nname: 0
n 0(None)[return self._get_parental_rating()
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7695d4c>}
nname: 0
n 0(None)[return _('Enter Setup universe')
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb769592c>}
nname: 324
n 324(None)[return None
]:
	i: 276(), 290(), 322(AE)
	o: 

nname: 322
n 322(None)[]:
	i: 280(f)
	o: 324(AE)

nname: 290
n 290(None)[#, e
log.error('Select failed: %s' % str(e))
]:
	i: 280(t)
	o: 324()

nname: 280
n 280(<dummy_ex3> EXC_MATCH Exception)[]:
	i: 32(except)
	o: 290(t), 322(f)

nname: 276
n 276(None)[]:
	i: 168(), 201(AL), 271(), 275()
	o: 324()

nname: 275
n 275(None)[]:
	i: 194(f)
	o: 276()

nname: 271
n 271(None)[]:
	i: 205(AF), 267()
	o: 276()

nname: 267
n 267(None)[]:
	i: 212(f), 231()
	o: 271()

nname: 231
n 231(None)[self.select(self._HomeMenu__get_named(name.lstrip('*')))
break
continue
]:
	i: 212(t)
	o: 267()

nname: 212
n 212(name[0] == '*')[for name in home_order:
]:
	i: 205(for)
	o: 231(t), 267(f)

nname: 205
n 205(None)[]:
	i: 201(loop)
	o: 212(for), 271(AF)

nname: 201
n 201(None)[]:
	i: 194(t)
	o: 205(loop), 276(AL)

nname: 194
n 194(home_order)[]:
	i: 162(f)
	o: 201(t), 275(f)

nname: 168
n 168(None)[self.select(self._HomeMenu__get_named(focus))
]:
	i: 162(t)
	o: 276()

nname: 162
n 162(focus)[]:
	i: 32(try)
	o: 168(t), 194(f)

nname: 32
n 32(None)[type_ = 'main'
self.eventhandler = HomeEventHandler(self)
Menu.__init__(self, type_, self.get_universes_items(), type=type_)
def self._getitems_keywords['item_name']():
	if self.selected:
		pass
	return self.selected

def self._getitems_keywords['parental_rating']():
	return self._get_parental_rating()

def self._getitems_keywords['help']():
	return _('Enter Setup universe')

self.get_item_list('main_list').cyclic = True
]:
	i: 21(), 28()
	o: 162(try), 280(except)

nname: 28
n 28(None)[]:
	i: 0(f)
	o: 32()

nname: 21
n 21(None)[]:
	i: 0(t)
	o: 32()

nname: 0
n 0('universe_switcher' in plugins)[self._navigator = None
]:
	i: 
	o: 21(t), 28(f)

nname: 324
n 324(None)[return None
]:
	i: 280(), 168(), 201(AL), 205(AF), 212(), 194(f)
	o: 

nname: 280
n 280(None)[except Exception, e:
	log.error('Select failed: %s' % str(e))
]:
	i: 162()
	o: 324()

nname: 212
n 212(None)[for name in home_order:
if name[0] == '*':
	self.select(self._HomeMenu__get_named(name.lstrip('*')))
	break
	continue
]:
	i: 205(for)
	o: 324()

nname: 205
n 205(None)[]:
	i: 201(loop)
	o: 212(for), 324(AF)

nname: 201
n 201(None)[]:
	i: 194(t)
	o: 205(loop), 324(AL)

nname: 194
n 194(home_order)[]:
	i: 162(f)
	o: 201(t), 324(f)

nname: 168
n 168(None)[self.select(self._HomeMenu__get_named(focus))
]:
	i: 162(t)
	o: 324()

nname: 162
n 162(focus)[try:
	pass
]:
	i: 0(try)
	o: 168(t), 194(f), 280()

nname: 0
n 0(None)[self._navigator = None
if 'universe_switcher' in plugins:
	pass
type_ = 'main'
self.eventhandler = HomeEventHandler(self)
Menu.__init__(self, type_, self.get_universes_items(), type=type_)
def self._getitems_keywords['item_name']():
	if self.selected:
		pass
	return self.selected

def self._getitems_keywords['parental_rating']():
	return self._get_parental_rating()

def self._getitems_keywords['help']():
	return _('Enter Setup universe')

self.get_item_list('main_list').cyclic = True
]:
	i: 
	o: 162(try)

nname: 324
n 324(None)[return None
]:
	i: 280(), 168(), 212(), 194(f)
	o: 

nname: 280
n 280(None)[except Exception, e:
	log.error('Select failed: %s' % str(e))
]:
	i: 0()
	o: 324()

nname: 212
n 212(None)[for name in home_order:
	if name[0] == '*':
		self.select(self._HomeMenu__get_named(name.lstrip('*')))
		break
		continue
]:
	i: 201(for)
	o: 324()

nname: 201
n 201(None)[]:
	i: 194(t)
	o: 212(for)

nname: 194
n 194(home_order)[]:
	i: 0(f)
	o: 201(t), 324(f)

nname: 168
n 168(None)[self.select(self._HomeMenu__get_named(focus))
]:
	i: 0(t)
	o: 324()

nname: 0
n 0(focus)[self._navigator = None
if 'universe_switcher' in plugins:
	pass
type_ = 'main'
self.eventhandler = HomeEventHandler(self)
Menu.__init__(self, type_, self.get_universes_items(), type=type_)
def self._getitems_keywords['item_name']():
	if self.selected:
		pass
	return self.selected

def self._getitems_keywords['parental_rating']():
	return self._get_parental_rating()

def self._getitems_keywords['help']():
	return _('Enter Setup universe')

self.get_item_list('main_list').cyclic = True
try:
	pass
]:
	i: 
	o: 168(t), 194(f), 280()

nname: 324
n 324(None)[return None
]:
	i: 280(), 168(), 201(), 194(f)
	o: 

nname: 280
n 280(None)[except Exception, e:
	log.error('Select failed: %s' % str(e))
]:
	i: 0()
	o: 324()

nname: 201
n 201(None)[for name in home_order:
	if name[0] == '*':
		self.select(self._HomeMenu__get_named(name.lstrip('*')))
		break
		continue
]:
	i: 194(t)
	o: 324()

nname: 194
n 194(home_order)[]:
	i: 0(f)
	o: 201(t), 324(f)

nname: 168
n 168(None)[self.select(self._HomeMenu__get_named(focus))
]:
	i: 0(t)
	o: 324()

nname: 0
n 0(focus)[self._navigator = None
if 'universe_switcher' in plugins:
	pass
type_ = 'main'
self.eventhandler = HomeEventHandler(self)
Menu.__init__(self, type_, self.get_universes_items(), type=type_)
def self._getitems_keywords['item_name']():
	if self.selected:
		pass
	return self.selected

def self._getitems_keywords['parental_rating']():
	return self._get_parental_rating()

def self._getitems_keywords['help']():
	return _('Enter Setup universe')

self.get_item_list('main_list').cyclic = True
try:
	pass
]:
	i: 
	o: 168(t), 194(f), 280()

nname: 324
n 324(None)[return None
]:
	i: 280(), 0()
	o: 

nname: 0
n 0(None)[self._navigator = None
if 'universe_switcher' in plugins:
	pass
type_ = 'main'
self.eventhandler = HomeEventHandler(self)
Menu.__init__(self, type_, self.get_universes_items(), type=type_)
def self._getitems_keywords['item_name']():
	if self.selected:
		pass
	return self.selected

def self._getitems_keywords['parental_rating']():
	return self._get_parental_rating()

def self._getitems_keywords['help']():
	return _('Enter Setup universe')

self.get_item_list('main_list').cyclic = True
try:
	pass
if focus:
	self.select(self._HomeMenu__get_named(focus))
else:
	if home_order:
		for name in home_order:
			if name[0] == '*':
				self.select(self._HomeMenu__get_named(name.lstrip('*')))
				break
				continue
]:
	i: 
	o: 324()

self.nodes: {0: <unpyclib.structure.node instance at 0xb769bacc>, 324: <unpyclib.structure.node instance at 0xb769b16c>, 280: <unpyclib.structure.node instance at 0xb769b5ec>}
nname: 45
n 45(None)[return 0
]:
	i: 0(AL), 44()
	o: 

nname: 44
n 44(None)[]:
	i: 3(AF), 40()
	o: 45()

nname: 40
n 40(None)[]:
	i: 14(f), 32()
	o: 44()

nname: 32
n 32(None)[return item
continue
]:
	i: 14(t)
	o: 40()

nname: 14
n 14(item.display_type == name)[for item in self['main_list']:
]:
	i: 3(for)
	o: 32(t), 40(f)

nname: 3
n 3(None)[]:
	i: 0(loop)
	o: 14(for), 44(AF)

nname: 0
n 0(None)[]:
	i: 
	o: 3(loop), 45(AL)

nname: 45
n 45(None)[return 0
]:
	i: 0(AL), 3(AF), 14()
	o: 

nname: 14
n 14(None)[for item in self['main_list']:
if item.display_type == name:
	return item
	continue
]:
	i: 3(for)
	o: 45()

nname: 3
n 3(None)[]:
	i: 0(loop)
	o: 14(for), 45(AF)

nname: 0
n 0(None)[]:
	i: 
	o: 3(loop), 45(AL)

nname: 14
n 14(None)[for item in self['main_list']:
	if item.display_type == name:
		return item
		continue
return 0
]:
	i: 0(for)
	o: 

nname: 0
n 0(None)[]:
	i: 
	o: 14(for)

nname: 0
n 0(None)[for item in self['main_list']:
	if item.display_type == name:
		return item
		continue
return 0
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76fb92c>}
nname: 53
n 53(None)[return None
]:
	i: 30(), 49()
	o: 

nname: 49
n 49(None)[]:
	i: 0&14(f)
	o: 53()

nname: 30
n 30(None)[]:
	i: 0&14(t)
	o: 53()

nname: 0&14
n 0&14(user_config['security']['parental_control'] and not user_config['security']['parent_mode'])[]:
	i: 
	o: 30(t), 49(f)

nname: 0&14
n 0&14(None)[if user_config['security']['parental_control'] and not user_config['security']['parent_mode']:
	pass
return None
]:
	i: 
	o: 

self.nodes: {'0&14': <unpyclib.structure.node instance at 0xb76fb7cc>}
nname: 114
n 114(None)[return has_changed
]:
	i: 71(), 113()
	o: 

nname: 113
n 113(None)[]:
	i: 35(f)
	o: 114()

nname: 71
n 71(None)[louie_send('item_name', sender=self, action='update', value=omnicode(self['item_name']))
]:
	i: 35(t)
	o: 114()

nname: 35
n 35(has_changed is not False)[has_changed = Menu.select(self, item, list_name, force_pos)
]:
	i: 15(), 34()
	o: 71(t), 113(f)

nname: 34
n 34(None)[]:
	i: 0(f)
	o: 35()

nname: 15
n 15(None)[item = self._HomeMenu__get_named(item)
]:
	i: 0(t)
	o: 35()

nname: 0
n 0(isinstance(item, basestring))[]:
	i: 
	o: 15(t), 34(f)

nname: 114
n 114(None)[return has_changed
]:
	i: 0()
	o: 

nname: 0
n 0(None)[if isinstance(item, basestring):
	item = self._HomeMenu__get_named(item)
has_changed = Menu.select(self, item, list_name, force_pos)
if has_changed is not False:
	louie_send('item_name', sender=self, action='update', value=omnicode(self['item_name']))
]:
	i: 
	o: 114()

nname: 0
n 0(None)[if isinstance(item, basestring):
	item = self._HomeMenu__get_named(item)
has_changed = Menu.select(self, item, list_name, force_pos)
if has_changed is not False:
	louie_send('item_name', sender=self, action='update', value=omnicode(self['item_name']))
return has_changed
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb769b24c>}
nname: 51
n 51(None)[Menu.show(self, hide_previous_menu, timeout)
]:
	i: 33(), 50()
	o: 

nname: 50
n 50(None)[]:
	i: 0&20(f)
	o: 51()

nname: 33
n 33(None)[self.select(last_universe)
]:
	i: 0&20(t)
	o: 51()

nname: 0&20
n 0&20(last_universe and 'restore_last_universe' in plugins)[last_universe = user_config['advanced']['last_universe']
]:
	i: 
	o: 33(t), 50(f)

nname: 0&20
n 0&20(None)[last_universe = user_config['advanced']['last_universe']
if last_universe and 'restore_last_universe' in plugins:
	self.select(last_universe)
Menu.show(self, hide_previous_menu, timeout)
]:
	i: 
	o: 

self.nodes: {'0&20': <unpyclib.structure.node instance at 0xb769b04c>}
nname: 134
n 134(None)[return None
]:
	i: 105(JA), 130(), 133()
	o: 

nname: 133
n 133(None)[]:
	i: 0(f)
	o: 134()

nname: 130
n 130(None)[]:
	i: 63(JA), 119()
	o: 134()

nname: 119
n 119(None)[sel.execute()
]:
	i: 15(f)
	o: 130()

nname: 105
n 105(None)[ms.back_one_menu()
]:
	i: 31(f)
	o: 134(JA)

nname: 63
n 63(None)[ms.back_to_menu(None)
ms.get_root().active_univ = sel
sel.execute()
]:
	i: 31(t)
	o: 130(JA)

nname: 31
n 31(sel != ms.get_root().active_univ)[ms = pygui_globs['menustack']
]:
	i: 15(t)
	o: 63(t), 105(f)

nname: 15
n 15(self.type == 'switcher')[]:
	i: 0(t)
	o: 31(t), 119(f)

nname: 0
n 0(sel)[sel = self.selected
]:
	i: 
	o: 15(t), 133(f)

nname: 134
n 134(None)[return None
]:
	i: 105(JA), 63(JA), 119(), 0(f)
	o: 

nname: 119
n 119(None)[sel.execute()
]:
	i: 15(f)
	o: 134()

nname: 105
n 105(None)[ms.back_one_menu()
]:
	i: 31(f)
	o: 134(JA)

nname: 63
n 63(None)[ms.back_to_menu(None)
ms.get_root().active_univ = sel
sel.execute()
]:
	i: 31(t)
	o: 134(JA)

nname: 31
n 31(sel != ms.get_root().active_univ)[ms = pygui_globs['menustack']
]:
	i: 15(t)
	o: 63(t), 105(f)

nname: 15
n 15(self.type == 'switcher')[]:
	i: 0(t)
	o: 31(t), 119(f)

nname: 0
n 0(sel)[sel = self.selected
]:
	i: 
	o: 15(t), 134(f)

nname: 0
n 0(None)[sel = self.selected
if sel:
	if self.type == 'switcher':
		ms = pygui_globs['menustack']
		if sel != ms.get_root().active_univ:
			ms.back_to_menu(None)
			ms.get_root().active_univ = sel
			sel.execute()
		else:
			ms.back_one_menu()
	else:
		sel.execute()
return None
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb769bbac>}
nname: 0
n 0(None)[from pygui.facilities import minimalist_home
minimalist_home.dump_home()
stop()
raise SystemExit('hasta la vista Catalina !')
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76fb8ac>}
nname: 46
n 46(None)[]:
	i: 3(), 33(), 44(AE)
	o: 

nname: 44
n 44(None)[]:
	i: 23(f)
	o: 46(AE)

nname: 33
n 33(None)[return 1000
]:
	i: 23(t)
	o: 46()

nname: 23
n 23(<dummy_ex3> EXC_MATCH ValueError)[]:
	i: 0(except)
	o: 33(t), 44(f)

nname: 3
n 3(None)[return ho.index(item.display_type)
]:
	i: 0(try)
	o: 46()

nname: 0
n 0(None)[]:
	i: 
	o: 3(try), 23(except)

nname: 23
n 23(None)[except ValueError:
	return 1000
]:
	i: 0()
	o: 

nname: 0
n 0(None)[try:
	return ho.index(item.display_type)
]:
	i: 
	o: 23()

nname: 0
n 0(None)[try:
	return ho.index(item.display_type)
except ValueError:
	return 1000
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb7690cac>}
nname: 327
n 327(None)[return home_items
]:
	i: 286(), 326()
	o: 

nname: 326
n 326(None)[]:
	i: 243(f)
	o: 327()

nname: 286
n 286(None)[del _[1]
for ho in home_order:
def _scorify(item):
	try:
		return ho.index(item.display_type)
	except ValueError:
		return 1000

home_items.sort(key=_scorify)
]:
	i: 249(AF), 264()
	o: 327()

nname: 264
n 264(None)[for n in home_order:
]:
	i: 249(for)
	o: 286()

nname: 249
n 249(None)[]:
	i: 243(t)
	o: 264(for), 286(AF)

nname: 243
n 243(home_order)[]:
	i: 0(AL), 242()
	o: 249(t), 326(f)

nname: 242
n 242(None)[]:
	i: 40(AF), 239()
	o: 243()

nname: 239
n 239(None)[]:
	i: 224(AE)
	o: 242()

nname: 224
n 224(None)[PRINT_EXCEPTION()
continue
]:
	i: 177(f), 188()
	o: 239(AE)

nname: 188
n 188(None)[#, e
log.warning('%s not implement in%s' % ('launch_%s' % universe, root_menu))
continue
]:
	i: 177(t)
	o: 224()

nname: 177
n 177(<dummy_ex3> EXC_MATCH AttributeError)[]:
	i: 129(f), 139()
	o: 188(t), 224(f)

nname: 139
n 139(None)[#, e
log.warning("The universe %s can't be loaded, error message below:\n%s" % (universe, str(e)))
continue
]:
	i: 129(t)
	o: 177()

nname: 129
n 129(<dummy_ex3> EXC_MATCH KeyError)[]:
	i: 47(except), 53()
	o: 139(t), 177(f)

nname: 53
n 53(None)[_[1], univ = [], UNIVERSE_LABELS[universe]
home_items.append(ActionItem(univ.label, type_='main', action=getattr(root_menu, 'launch_%s' % universe), display_type=universe, args=univ.args))
continue
]:
	i: 47(try)
	o: 129()

nname: 47
n 47(None)[for universe in home_plugins:
]:
	i: 40(for)
	o: 53(try), 129(except)

nname: 40
n 40(None)[]:
	i: 0(loop)
	o: 47(for), 242(AF)

nname: 0
n 0(None)[home_plugins = plugins.get('home')
home_items = []
root_menu = pygui_globs['menustack'].get_root()
]:
	i: 
	o: 40(loop), 243(AL)

nname: 327
n 327(None)[return home_items
]:
	i: 286(), 243(f)
	o: 

nname: 286
n 286(None)[del _[1]
for ho in home_order:
def _scorify(item):
	try:
		return ho.index(item.display_type)
	except ValueError:
		return 1000

home_items.sort(key=_scorify)
]:
	i: 249(AF), 264()
	o: 327()

nname: 264
n 264(None)[for n in home_order:
]:
	i: 249(for)
	o: 286()

nname: 249
n 249(None)[]:
	i: 243(t)
	o: 264(for), 286(AF)

nname: 243
n 243(home_order)[]:
	i: 0(AL), 40(AF), 224(AE)
	o: 249(t), 327(f)

nname: 224
n 224(None)[PRINT_EXCEPTION()
continue
]:
	i: 129(f)
	o: 243(AE)

nname: 129
n 129(None)[except KeyError, e:
	log.warning("The universe %s can't be loaded, error message below:\n%s" % (universe, str(e)))
	continue
except AttributeError, e:
	log.warning('%s not implement in%s' % ('launch_%s' % universe, root_menu))
	continue
]:
	i: 47()
	o: 224()

nname: 47
n 47(None)[for universe in home_plugins:
try:
	_[1], univ = [], UNIVERSE_LABELS[universe]
	home_items.append(ActionItem(univ.label, type_='main', action=getattr(root_menu, 'launch_%s' % universe), display_type=universe, args=univ.args))
	continue
]:
	i: 40(for)
	o: 129()

nname: 40
n 40(None)[]:
	i: 0(loop)
	o: 47(for), 243(AF)

nname: 0
n 0(None)[home_plugins = plugins.get('home')
home_items = []
root_menu = pygui_globs['menustack'].get_root()
]:
	i: 
	o: 40(loop), 243(AL)

nname: 327
n 327(None)[return home_items
]:
	i: 286(), 243(f)
	o: 

nname: 286
n 286(None)[del _[1]
for ho in home_order:
def _scorify(item):
	try:
		return ho.index(item.display_type)
	except ValueError:
		return 1000

home_items.sort(key=_scorify)
]:
	i: 249(AF), 264()
	o: 327()

nname: 264
n 264(None)[for n in home_order:
]:
	i: 249(for)
	o: 286()

nname: 249
n 249(None)[]:
	i: 243(t)
	o: 264(for), 286(AF)

nname: 243
n 243(home_order)[]:
	i: 0(AL), 40(AF), 224(AE)
	o: 249(t), 327(f)

nname: 224
n 224(None)[PRINT_EXCEPTION()
continue
]:
	i: 47(f)
	o: 243(AE)

nname: 47
n 47(None)[for universe in home_plugins:
try:
	_[1], univ = [], UNIVERSE_LABELS[universe]
	home_items.append(ActionItem(univ.label, type_='main', action=getattr(root_menu, 'launch_%s' % universe), display_type=universe, args=univ.args))
	continue
except KeyError, e:
	log.warning("The universe %s can't be loaded, error message below:\n%s" % (universe, str(e)))
	continue
except AttributeError, e:
	log.warning('%s not implement in%s' % ('launch_%s' % universe, root_menu))
	continue
]:
	i: 40(for)
	o: 224()

nname: 40
n 40(None)[]:
	i: 0(loop)
	o: 47(for), 243(AF)

nname: 0
n 0(None)[home_plugins = plugins.get('home')
home_items = []
root_menu = pygui_globs['menustack'].get_root()
]:
	i: 
	o: 40(loop), 243(AL)

nname: 327
n 327(None)[return home_items
]:
	i: 286(), 243(f)
	o: 

nname: 286
n 286(None)[del _[1]
for ho in home_order:
def _scorify(item):
	try:
		return ho.index(item.display_type)
	except ValueError:
		return 1000

home_items.sort(key=_scorify)
]:
	i: 249(AF), 264()
	o: 327()

nname: 264
n 264(None)[for n in home_order:
]:
	i: 249(for)
	o: 286()

nname: 249
n 249(None)[]:
	i: 243(t)
	o: 264(for), 286(AF)

nname: 243
n 243(home_order)[]:
	i: 0(AL), 40(AF), 47(AE)
	o: 249(t), 327(f)

nname: 47
n 47(None)[for universe in home_plugins:
try:
	_[1], univ = [], UNIVERSE_LABELS[universe]
	home_items.append(ActionItem(univ.label, type_='main', action=getattr(root_menu, 'launch_%s' % universe), display_type=universe, args=univ.args))
	continue
except KeyError, e:
	log.warning("The universe %s can't be loaded, error message below:\n%s" % (universe, str(e)))
	continue
except AttributeError, e:
	log.warning('%s not implement in%s' % ('launch_%s' % universe, root_menu))
	continue
PRINT_EXCEPTION()
continue
]:
	i: 40(for)
	o: 243(AE)

nname: 40
n 40(None)[]:
	i: 0(loop)
	o: 47(for), 243(AF)

nname: 0
n 0(None)[home_plugins = plugins.get('home')
home_items = []
root_menu = pygui_globs['menustack'].get_root()
]:
	i: 
	o: 40(loop), 243(AL)

nname: 327
n 327(None)[return home_items
]:
	i: 286(), 243(f)
	o: 

nname: 286
n 286(None)[del _[1]
for ho in home_order:
def _scorify(item):
	try:
		return ho.index(item.display_type)
	except ValueError:
		return 1000

home_items.sort(key=_scorify)
]:
	i: 249(AF), 264()
	o: 327()

nname: 264
n 264(None)[for n in home_order:
]:
	i: 249(for)
	o: 286()

nname: 249
n 249(None)[]:
	i: 243(t)
	o: 264(for), 286(AF)

nname: 243
n 243(home_order)[]:
	i: 47(AE)
	o: 249(t), 327(f)

nname: 47
n 47(None)[for universe in home_plugins:
	try:
		_[1], univ = [], UNIVERSE_LABELS[universe]
		home_items.append(ActionItem(univ.label, type_='main', action=getattr(root_menu, 'launch_%s' % universe), display_type=universe, args=univ.args))
		continue
	except KeyError, e:
		log.warning("The universe %s can't be loaded, error message below:\n%s" % (universe, str(e)))
		continue
	except AttributeError, e:
		log.warning('%s not implement in%s' % ('launch_%s' % universe, root_menu))
		continue
	PRINT_EXCEPTION()
	continue
]:
	i: 0(for)
	o: 243(AE)

nname: 0
n 0(None)[home_plugins = plugins.get('home')
home_items = []
root_menu = pygui_globs['menustack'].get_root()
]:
	i: 
	o: 47(for)

nname: 327
n 327(None)[return home_items
]:
	i: 286(), 243(f)
	o: 

nname: 286
n 286(None)[del _[1]
for ho in home_order:
def _scorify(item):
	try:
		return ho.index(item.display_type)
	except ValueError:
		return 1000

home_items.sort(key=_scorify)
]:
	i: 249(AF), 264()
	o: 327()

nname: 264
n 264(None)[for n in home_order:
]:
	i: 249(for)
	o: 286()

nname: 249
n 249(None)[]:
	i: 243(t)
	o: 264(for), 286(AF)

nname: 243
n 243(home_order)[]:
	i: 0(AE)
	o: 249(t), 327(f)

nname: 0
n 0(None)[home_plugins = plugins.get('home')
home_items = []
root_menu = pygui_globs['menustack'].get_root()
for universe in home_plugins:
	try:
		_[1], univ = [], UNIVERSE_LABELS[universe]
		home_items.append(ActionItem(univ.label, type_='main', action=getattr(root_menu, 'launch_%s' % universe), display_type=universe, args=univ.args))
		continue
	except KeyError, e:
		log.warning("The universe %s can't be loaded, error message below:\n%s" % (universe, str(e)))
		continue
	except AttributeError, e:
		log.warning('%s not implement in%s' % ('launch_%s' % universe, root_menu))
		continue
	PRINT_EXCEPTION()
	continue
]:
	i: 
	o: 243(AE)

self.nodes: {0: <unpyclib.structure.node instance at 0xb7695a6c>, 327: <unpyclib.structure.node instance at 0xb76904ec>, 286: <unpyclib.structure.node instance at 0xb769046c>, 243: <unpyclib.structure.node instance at 0xb769030c>, 249: <unpyclib.structure.node instance at 0xb76903cc>, 264: <unpyclib.structure.node instance at 0xb769040c>}
nname: 159
n 159(None)[]:
	i: 136(), 149()
	o: 

nname: 149
n 149(None)[]:
	i: 0(t)
	o: 159()

nname: 136
n 136(None)[]:
	i: 0(f)
	o: 159()

nname: 0
n 0(user_config['base']['help_banner'])[louie_send('item_name', sender=self, action='reset', value=self['item_name'])
louie_send('main_list', sender=self, action='reset', value=self['main_list'])
louie_send('parental_rating', sender=self, action='reset', value=self['parental_rating'])
louie_send('help', sender=self, value=self['help'])
]:
	i: 
	o: 136(f), 149(t)

nname: 0
n 0(None)[louie_send('item_name', sender=self, action='reset', value=self['item_name'])
louie_send('main_list', sender=self, action='reset', value=self['main_list'])
louie_send('parental_rating', sender=self, action='reset', value=self['parental_rating'])
louie_send('help', sender=self, value=self['help'])
if not user_config['base']['help_banner']:
	pass
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb769572c>}
nname: 6
n 6(None)[__doc__ = '\n    merge UniverseSwitcher and HomeMenu (in fact, only event_handler and xml should change)\n    '
def __init__(self, focus=False):
	self._navigator = None
	if 'universe_switcher' in plugins:
		pass
	type_ = 'main'
	self.eventhandler = HomeEventHandler(self)
	Menu.__init__(self, type_, self.get_universes_items(), type=type_)
	def self._getitems_keywords['item_name']():
		if self.selected:
			pass
		return self.selected

	def self._getitems_keywords['parental_rating']():
		return self._get_parental_rating()

	def self._getitems_keywords['help']():
		return _('Enter Setup universe')

	self.get_item_list('main_list').cyclic = True
	try:
		pass
	if focus:
		self.select(self._HomeMenu__get_named(focus))
	else:
		if home_order:
			for name in home_order:
				if name[0] == '*':
					self.select(self._HomeMenu__get_named(name.lstrip('*')))
					break
					continue

def _HomeMenu__get_named(self, name):
	for item in self['main_list']:
		if item.display_type == name:
			return item
			continue
	return 0

def _get_parental_rating(self):
	if user_config['security']['parental_control'] and not user_config['security']['parent_mode']:
		pass
	return None

def select(self, item, list_name=None, force_pos=False):
	if isinstance(item, basestring):
		item = self._HomeMenu__get_named(item)
	has_changed = Menu.select(self, item, list_name, force_pos)
	if has_changed is not False:
		louie_send('item_name', sender=self, action='update', value=omnicode(self['item_name']))
	return has_changed

def show(self, hide_previous_menu=True, timeout=None):
	last_universe = user_config['advanced']['last_universe']
	if last_universe and 'restore_last_universe' in plugins:
		self.select(last_universe)
	Menu.show(self, hide_previous_menu, timeout)

def execute_selected(self):
	sel = self.selected
	if sel:
		if self.type == 'switcher':
			ms = pygui_globs['menustack']
			if sel != ms.get_root().active_univ:
				ms.back_to_menu(None)
				ms.get_root().active_univ = sel
				sel.execute()
			else:
				ms.back_one_menu()
		else:
			sel.execute()
	return None

def byebye(self):
	from pygui.facilities import minimalist_home
	minimalist_home.dump_home()
	stop()
	raise SystemExit('hasta la vista Catalina !')

def get_universes_items(self):
	home_plugins = plugins.get('home')
	home_items = []
	root_menu = pygui_globs['menustack'].get_root()
	for universe in home_plugins:
		try:
			_[1], univ = [], UNIVERSE_LABELS[universe]
			home_items.append(ActionItem(univ.label, type_='main', action=getattr(root_menu, 'launch_%s' % universe), display_type=universe, args=univ.args))
			continue
		except KeyError, e:
			log.warning("The universe %s can't be loaded, error message below:\n%s" % (universe, str(e)))
			continue
		except AttributeError, e:
			log.warning('%s not implement in%s' % ('launch_%s' % universe, root_menu))
			continue
		PRINT_EXCEPTION()
		continue

def reload_func(self):
	louie_send('item_name', sender=self, action='reset', value=self['item_name'])
	louie_send('main_list', sender=self, action='reset', value=self['main_list'])
	louie_send('parental_rating', sender=self, action='reset', value=self['parental_rating'])
	louie_send('help', sender=self, value=self['help'])
	if not user_config['base']['help_banner']:
		pass

]:
	i: 
	o: 

self.nodes: {6: <unpyclib.structure.node instance at 0xb76fbf2c>}
nname: 0
n 0(None)[from __future__ import absolute_import
__all__ = ['HomeMenu', 'UniverseSwitcherMenu', 'RootMenu']
from .core import Menu
from peewee.messages import send as louie_send
from peewee.debug import GET_LOGGER, PRINT_EXCEPTION
from peewee.notifier import stop, Task
from pygui.config import plugins, url_list, home_order, user_config
from pygui.eventmanager import EventDispatcher
from pygui.eventmanager.menus import HomeEventHandler
from pygui.facilities.l10n import omnicode
from pygui.facilities.codemapping import control_mode_popup_dict
from pygui.item.core import ActionItem
from pygui.item.mediaitem.core import TVRootItem, ChannelItem
from pygui.shared import pygui_globs
from pygui.window import Button, ConfirmWindow, MessageWindow
log = GET_LOGGER(__name__)
class TraducedLabel(object):
	def __init__(self, caption):
		self._caption = caption

	def __str__(self):
		return _(self._caption)



class UniverseLabel(object):
	def __init__(self, label, *args):
		self.args = args
		self.label = label



UNIVERSE_LABELS = {'tv': UniverseLabel(TraducedLabel('TV')), 'audio': UniverseLabel(TraducedLabel('Music'), 'audio'), 'video_image': UniverseLabel(TraducedLabel('Video/Photo'), 'video_image'), 'radio': UniverseLabel(TraducedLabel('Radio')), 'web': UniverseLabel(TraducedLabel('Web Browser')), 'games': UniverseLabel(TraducedLabel('Games')), 'hdmi_tv_1': UniverseLabel(TraducedLabel('HDMI1')), 'hdmi_tv_2': UniverseLabel(TraducedLabel('HDMI2')), 'image': UniverseLabel(TraducedLabel('Image'), 'image'), 'video': UniverseLabel(TraducedLabel('Video'), 'video'), 'net_services': UniverseLabel(TraducedLabel('Internet Services'), 'net_services'), 'multiverse': UniverseLabel(TraducedLabel('Navigator'), 'multiverse'), 'parameters': UniverseLabel(TraducedLabel('Parameters')), 'test_menu': UniverseLabel(TraducedLabel('Test'))}
class RootMenu(Menu):
	__doc__ = "\n    The Root Menu is a menu always present in the stack.\n    He is not supposed to have a specific view, nor specific features.\n    It's the base menu, used to register all the global callbacks\n    "
	def __init__(self):
		self.eventHandler = EventDispatcher(self)
		self._navigator = None
		Menu.__init__(self, 'root', type='root')
		def self._getitems_keywords['message']():
			return _('Press Home to switch universe')

		import wymedia.wmplus as w
		w.register_plug_callback((lambda obj: Task(self.device_plugged, obj, True).start(0)))
		w.register_unplug_callback((lambda obj: Task(self.device_plugged, obj, False).start(0)))
		from peewee.controlmode import ControlModeManager
		ctrl = ControlModeManager()
		ctrl.register_observer(self.control_changed)
		pygui_globs['controlmodemanager'] = ctrl
		self._controlmode_popup = None
		self.active_univ = None
		return None

	def show(self, hide_previous_menu=True, timeout=None):
		Menu.show(self, hide_previous_menu, timeout)
		if 'restore_last_universe' in plugins and not user_config['advanced']['last_universe']:
			louie_send('show_select_universe', sender=self)

	def control_changed(self, mode, rcu, standby):
		from peewee.notifier import events_drop
		from pygui.facilities.power import PowerManager
		from pygui.menu.menu.bsod import BSoDMenu
		log.debug('Control changed: mode=%s rcu=%s standby=%s', mode, rcu, standby)
		msg = control_mode_popup_dict[mode]
		if rcu:
			if self._controlmode_popup:
				self._controlmode_popup.hide()
				self._controlmode_popup = None
			events_drop(False)
			plugins.discard('popup_blocker')
			stack = pygui_globs['menustack']
			if not stack.is_on_firstboot():
				stack.back_to_home()
			MessageWindow(msg, button=None).show(timeout=3)
		else:
			events_drop(True)
			plugins.add('popup_blocker')
			stack = pygui_globs['menustack']
			if not stack.is_on_firstboot():
				stack.back_to_home()
				BSoDMenu().show()
			self._controlmode_popup = MessageWindow(msg, button=None)
			self._controlmode_popup.show()
		return None

	def device_plugged(self, obj, plugged):
		if not obj.get('title'):
			pass
		name = obj.get('title')
		if plugged:
			msg_template = _('Device "%(name)s" plugged in.')
		else:
			msg_template = _('Device "%(name)s" removed.')
		msg = msg_template % {'name': name}
		log.debug('%s / %s', msg, name)
		stack = pygui_globs['menustack']
		if plugged:
			if 'WYDEMO' in obj['title'].upper():
				from pygui.facilities.demomode import handle_demo
				handle_demo(obj)
		if obj.get('backend', '') != 'upnp':
			try:
				UpdateManager().unplug_update()
			except:
				PRINT_EXCEPTION()

	def launch_parameters(self):
		def _display_setup():
			from .parameters import MainSetupParametersNotebookMenu
			from pygui.item.parameters.generalsetup import GeneralConfigurationItem
			user_config['security']['parent_mode'] = True
			user_config.save()
			sm = MainSetupParametersNotebookMenu(name=_('Parameters'), type='notebook_setup_parameters', universe='parameters')
			sm.show(sub_to_show=GeneralConfigurationItem)

		def _display_qa():
			from pygui.menu.menu.security import QuestionAnswerCheckLauncher
			QuestionAnswerCheckLauncher(_display_setup)

		if user_config['security']['parent_mode'] or not user_config['security']['parental_control']:
			_display_setup()
		else:
			from .parameters import SecretCodeCheckMenu
			sc = SecretCodeCheckMenu(name=_('Check PIN Code'), action=_display_setup, cancel_action=_display_qa)
			pygui_globs['menustack'].push_menu(sc)

	def launch_tv(self):
		def _fullscan():
			from pygui.item.parameters.tv.tvsetup import TNTAutomaticScanItem
			item = TNTAutomaticScanItem(parent=None, name=_('Automatic scan'), type_='setupitem')
			item.menu = self
			item.execute()
			return None

		def prompt_tv_scan(play_on_no=False):
			buttons = [Button(_('Yes'), True), Button(_('No'), False)]
			buttons[0].connect(_fullscan)
			if play_on_no:
				buttons[1].connect(ChannelItem.player.play)
			messbox = ConfirmWindow(text=_('Do you want to launch a scan now?'), buttons=buttons)
			messbox.show()

		try:
			acl = TVRootItem().get_acl(menu=self)
			channels = acl.browse()
			num_channels = len(channels)
		except:
			w = MessageWindow(text=_('Channels are unavailable. Please try again.\nIf the problem persists, launch a scan or reset to factory defaults.'), title=_('TV failure'))
			w.show(timeout=3)
			PRINT_EXCEPTION()
		user_config['advanced']['last_universe'] = 'tv'
		user_config.save()
		if num_channels == 0:
			_fullscan()
		else:
			if num_channels == 1 and channels[0]['class'].endswith('videoCapture'):
				prompt_tv_scan(play_on_no=True)
			else:
				ChannelItem.player.play()

	def launch_net_services(self, name):
		from peewee.networkmanager import NetworkManager
		NM = NetworkManager()
		if NM.get_state() == 'disconnected':
			stack.back_to_home()
			MessageWindow(text='Please configure connection', title='Not connected', button=False).show(timeout=5)
		else:
			if name == 'net_services':
				from wymedia.wmplus import set_param
				login, password = user_config['net']['login'], user_config['net']['password']
				if login is not None:
					log.info("'user' param set for net services'")
					set_param('user', login)
				if password is not None:
					log.info("'pass' param set for net services'")
					set_param('pass', password)
				lang = user_config['base']['language']
				log.info("'lang' param set for net services'")
				set_param('lang', lang)
			if self._navigator is None:
				from pygui.menu.menu import Navigator
				self._navigator = Navigator(name, name, [], type=name)
			else:
				self._navigator.reset(name, type=name, universe=name)
			self._navigator.show()
			user_config['advanced']['last_universe'] = name
			user_config.save()
		return None

	def launch_navigator(self, name):
		if self._navigator is None:
			from pygui.menu.menu import Navigator
			self._navigator = Navigator(name, name, [], type=name)
		else:
			self._navigator.reset(name, type=name, universe=name)
		self._navigator.show()
		user_config['advanced']['last_universe'] = name
		user_config.save()
		return None

	launch_multiverse, launch_audio, launch_video, launch_video_image, launch_image = launch_navigator, launch_navigator, launch_navigator, launch_navigator, launch_navigator
	def launch_web(self):
		from pygui.item.web import URLItem
		URLItem.player.play(url)
		user_config['advanced']['last_universe'] = 'web'
		user_config.save()

	def launch_testmenu(self):
		from pygui.menu.menu.test_menu import GenMenu
		GenMenu().show()

	def launch_hdmi(self):
		from .bsod import BSoDMenu
		hdmi_menu = BSoDMenu()
		pygui_globs['menustack'].push_menu(hdmi_menu)

	launch_hdmi_tv_1, launch_hdmi_tv_2, launch_hdmi_tv = launch_hdmi, launch_hdmi, launch_hdmi
	def launch_failsafe(self):
		from pygui.menu.menu import FailsafeMenu
		FailsafeMenu().show()



class HomeMenu(Menu):
	__doc__ = '\n    merge UniverseSwitcher and HomeMenu (in fact, only event_handler and xml should change)\n    '
	def __init__(self, focus=False):
		self._navigator = None
		if 'universe_switcher' in plugins:
			pass
		type_ = 'main'
		self.eventhandler = HomeEventHandler(self)
		Menu.__init__(self, type_, self.get_universes_items(), type=type_)
		def self._getitems_keywords['item_name']():
			if self.selected:
				pass
			return self.selected

		def self._getitems_keywords['parental_rating']():
			return self._get_parental_rating()

		def self._getitems_keywords['help']():
			return _('Enter Setup universe')

		self.get_item_list('main_list').cyclic = True
		try:
			pass
		if focus:
			self.select(self._HomeMenu__get_named(focus))
		else:
			if home_order:
				for name in home_order:
					if name[0] == '*':
						self.select(self._HomeMenu__get_named(name.lstrip('*')))
						break
						continue

	def _HomeMenu__get_named(self, name):
		for item in self['main_list']:
			if item.display_type == name:
				return item
				continue
		return 0

	def _get_parental_rating(self):
		if user_config['security']['parental_control'] and not user_config['security']['parent_mode']:
			pass
		return None

	def select(self, item, list_name=None, force_pos=False):
		if isinstance(item, basestring):
			item = self._HomeMenu__get_named(item)
		has_changed = Menu.select(self, item, list_name, force_pos)
		if has_changed is not False:
			louie_send('item_name', sender=self, action='update', value=omnicode(self['item_name']))
		return has_changed

	def show(self, hide_previous_menu=True, timeout=None):
		last_universe = user_config['advanced']['last_universe']
		if last_universe and 'restore_last_universe' in plugins:
			self.select(last_universe)
		Menu.show(self, hide_previous_menu, timeout)

	def execute_selected(self):
		sel = self.selected
		if sel:
			if self.type == 'switcher':
				ms = pygui_globs['menustack']
				if sel != ms.get_root().active_univ:
					ms.back_to_menu(None)
					ms.get_root().active_univ = sel
					sel.execute()
				else:
					ms.back_one_menu()
			else:
				sel.execute()
		return None

	def byebye(self):
		from pygui.facilities import minimalist_home
		minimalist_home.dump_home()
		stop()
		raise SystemExit('hasta la vista Catalina !')

	def get_universes_items(self):
		home_plugins = plugins.get('home')
		home_items = []
		root_menu = pygui_globs['menustack'].get_root()
		for universe in home_plugins:
			try:
				_[1], univ = [], UNIVERSE_LABELS[universe]
				home_items.append(ActionItem(univ.label, type_='main', action=getattr(root_menu, 'launch_%s' % universe), display_type=universe, args=univ.args))
				continue
			except KeyError, e:
				log.warning("The universe %s can't be loaded, error message below:\n%s" % (universe, str(e)))
				continue
			except AttributeError, e:
				log.warning('%s not implement in%s' % ('launch_%s' % universe, root_menu))
				continue
			PRINT_EXCEPTION()
			continue

	def reload_func(self):
		louie_send('item_name', sender=self, action='reset', value=self['item_name'])
		louie_send('main_list', sender=self, action='reset', value=self['main_list'])
		louie_send('parental_rating', sender=self, action='reset', value=self['parental_rating'])
		louie_send('help', sender=self, value=self['help'])
		if not user_config['base']['help_banner']:
			pass



from pygui.facilities.update import UpdateManager
]:
	i: 
	o: 

self.nodes: {0: <unpyclib.structure.node instance at 0xb76f796c>}
from __future__ import absolute_import
__all__ = ['HomeMenu', 'UniverseSwitcherMenu', 'RootMenu']
from .core import Menu
from peewee.messages import send as louie_send
from peewee.debug import GET_LOGGER, PRINT_EXCEPTION
from peewee.notifier import stop, Task
from pygui.config import plugins, url_list, home_order, user_config
from pygui.eventmanager import EventDispatcher
from pygui.eventmanager.menus import HomeEventHandler
from pygui.facilities.l10n import omnicode
from pygui.facilities.codemapping import control_mode_popup_dict
from pygui.item.core import ActionItem
from pygui.item.mediaitem.core import TVRootItem, ChannelItem
from pygui.shared import pygui_globs
from pygui.window import Button, ConfirmWindow, MessageWindow
log = GET_LOGGER(__name__)
class TraducedLabel(object):
	def __init__(self, caption):
		self._caption = caption

	def __str__(self):
		return _(self._caption)



class UniverseLabel(object):
	def __init__(self, label, *args):
		self.args = args
		self.label = label



UNIVERSE_LABELS = {'tv': UniverseLabel(TraducedLabel('TV')), 'audio': UniverseLabel(TraducedLabel('Music'), 'audio'), 'video_image': UniverseLabel(TraducedLabel('Video/Photo'), 'video_image'), 'radio': UniverseLabel(TraducedLabel('Radio')), 'web': UniverseLabel(TraducedLabel('Web Browser')), 'games': UniverseLabel(TraducedLabel('Games')), 'hdmi_tv_1': UniverseLabel(TraducedLabel('HDMI1')), 'hdmi_tv_2': UniverseLabel(TraducedLabel('HDMI2')), 'image': UniverseLabel(TraducedLabel('Image'), 'image'), 'video': UniverseLabel(TraducedLabel('Video'), 'video'), 'net_services': UniverseLabel(TraducedLabel('Internet Services'), 'net_services'), 'multiverse': UniverseLabel(TraducedLabel('Navigator'), 'multiverse'), 'parameters': UniverseLabel(TraducedLabel('Parameters')), 'test_menu': UniverseLabel(TraducedLabel('Test'))}
class RootMenu(Menu):
	__doc__ = "\n    The Root Menu is a menu always present in the stack.\n    He is not supposed to have a specific view, nor specific features.\n    It's the base menu, used to register all the global callbacks\n    "
	def __init__(self):
		self.eventHandler = EventDispatcher(self)
		self._navigator = None
		Menu.__init__(self, 'root', type='root')
		def self._getitems_keywords['message']():
			return _('Press Home to switch universe')

		import wymedia.wmplus as w
		w.register_plug_callback((lambda obj: Task(self.device_plugged, obj, True).start(0)))
		w.register_unplug_callback((lambda obj: Task(self.device_plugged, obj, False).start(0)))
		from peewee.controlmode import ControlModeManager
		ctrl = ControlModeManager()
		ctrl.register_observer(self.control_changed)
		pygui_globs['controlmodemanager'] = ctrl
		self._controlmode_popup = None
		self.active_univ = None
		return None

	def show(self, hide_previous_menu=True, timeout=None):
		Menu.show(self, hide_previous_menu, timeout)
		if 'restore_last_universe' in plugins and not user_config['advanced']['last_universe']:
			louie_send('show_select_universe', sender=self)

	def control_changed(self, mode, rcu, standby):
		from peewee.notifier import events_drop
		from pygui.facilities.power import PowerManager
		from pygui.menu.menu.bsod import BSoDMenu
		log.debug('Control changed: mode=%s rcu=%s standby=%s', mode, rcu, standby)
		msg = control_mode_popup_dict[mode]
		if rcu:
			if self._controlmode_popup:
				self._controlmode_popup.hide()
				self._controlmode_popup = None
			events_drop(False)
			plugins.discard('popup_blocker')
			stack = pygui_globs['menustack']
			if not stack.is_on_firstboot():
				stack.back_to_home()
			MessageWindow(msg, button=None).show(timeout=3)
		else:
			events_drop(True)
			plugins.add('popup_blocker')
			stack = pygui_globs['menustack']
			if not stack.is_on_firstboot():
				stack.back_to_home()
				BSoDMenu().show()
			self._controlmode_popup = MessageWindow(msg, button=None)
			self._controlmode_popup.show()
		return None

	def device_plugged(self, obj, plugged):
		if not obj.get('title'):
			pass
		name = obj.get('title')
		if plugged:
			msg_template = _('Device "%(name)s" plugged in.')
		else:
			msg_template = _('Device "%(name)s" removed.')
		msg = msg_template % {'name': name}
		log.debug('%s / %s', msg, name)
		stack = pygui_globs['menustack']
		if plugged:
			if 'WYDEMO' in obj['title'].upper():
				from pygui.facilities.demomode import handle_demo
				handle_demo(obj)
		if obj.get('backend', '') != 'upnp':
			try:
				UpdateManager().unplug_update()
			except:
				PRINT_EXCEPTION()

	def launch_parameters(self):
		def _display_setup():
			from .parameters import MainSetupParametersNotebookMenu
			from pygui.item.parameters.generalsetup import GeneralConfigurationItem
			user_config['security']['parent_mode'] = True
			user_config.save()
			sm = MainSetupParametersNotebookMenu(name=_('Parameters'), type='notebook_setup_parameters', universe='parameters')
			sm.show(sub_to_show=GeneralConfigurationItem)

		def _display_qa():
			from pygui.menu.menu.security import QuestionAnswerCheckLauncher
			QuestionAnswerCheckLauncher(_display_setup)

		if user_config['security']['parent_mode'] or not user_config['security']['parental_control']:
			_display_setup()
		else:
			from .parameters import SecretCodeCheckMenu
			sc = SecretCodeCheckMenu(name=_('Check PIN Code'), action=_display_setup, cancel_action=_display_qa)
			pygui_globs['menustack'].push_menu(sc)

	def launch_tv(self):
		def _fullscan():
			from pygui.item.parameters.tv.tvsetup import TNTAutomaticScanItem
			item = TNTAutomaticScanItem(parent=None, name=_('Automatic scan'), type_='setupitem')
			item.menu = self
			item.execute()
			return None

		def prompt_tv_scan(play_on_no=False):
			buttons = [Button(_('Yes'), True), Button(_('No'), False)]
			buttons[0].connect(_fullscan)
			if play_on_no:
				buttons[1].connect(ChannelItem.player.play)
			messbox = ConfirmWindow(text=_('Do you want to launch a scan now?'), buttons=buttons)
			messbox.show()

		try:
			acl = TVRootItem().get_acl(menu=self)
			channels = acl.browse()
			num_channels = len(channels)
		except:
			w = MessageWindow(text=_('Channels are unavailable. Please try again.\nIf the problem persists, launch a scan or reset to factory defaults.'), title=_('TV failure'))
			w.show(timeout=3)
			PRINT_EXCEPTION()
		user_config['advanced']['last_universe'] = 'tv'
		user_config.save()
		if num_channels == 0:
			_fullscan()
		else:
			if num_channels == 1 and channels[0]['class'].endswith('videoCapture'):
				prompt_tv_scan(play_on_no=True)
			else:
				ChannelItem.player.play()

	def launch_net_services(self, name):
		from peewee.networkmanager import NetworkManager
		NM = NetworkManager()
		if NM.get_state() == 'disconnected':
			stack.back_to_home()
			MessageWindow(text='Please configure connection', title='Not connected', button=False).show(timeout=5)
		else:
			if name == 'net_services':
				from wymedia.wmplus import set_param
				login, password = user_config['net']['login'], user_config['net']['password']
				if login is not None:
					log.info("'user' param set for net services'")
					set_param('user', login)
				if password is not None:
					log.info("'pass' param set for net services'")
					set_param('pass', password)
				lang = user_config['base']['language']
				log.info("'lang' param set for net services'")
				set_param('lang', lang)
			if self._navigator is None:
				from pygui.menu.menu import Navigator
				self._navigator = Navigator(name, name, [], type=name)
			else:
				self._navigator.reset(name, type=name, universe=name)
			self._navigator.show()
			user_config['advanced']['last_universe'] = name
			user_config.save()
		return None

	def launch_navigator(self, name):
		if self._navigator is None:
			from pygui.menu.menu import Navigator
			self._navigator = Navigator(name, name, [], type=name)
		else:
			self._navigator.reset(name, type=name, universe=name)
		self._navigator.show()
		user_config['advanced']['last_universe'] = name
		user_config.save()
		return None

	launch_multiverse, launch_audio, launch_video, launch_video_image, launch_image = launch_navigator, launch_navigator, launch_navigator, launch_navigator, launch_navigator
	def launch_web(self):
		from pygui.item.web import URLItem
		URLItem.player.play(url)
		user_config['advanced']['last_universe'] = 'web'
		user_config.save()

	def launch_testmenu(self):
		from pygui.menu.menu.test_menu import GenMenu
		GenMenu().show()

	def launch_hdmi(self):
		from .bsod import BSoDMenu
		hdmi_menu = BSoDMenu()
		pygui_globs['menustack'].push_menu(hdmi_menu)

	launch_hdmi_tv_1, launch_hdmi_tv_2, launch_hdmi_tv = launch_hdmi, launch_hdmi, launch_hdmi
	def launch_failsafe(self):
		from pygui.menu.menu import FailsafeMenu
		FailsafeMenu().show()



class HomeMenu(Menu):
	__doc__ = '\n    merge UniverseSwitcher and HomeMenu (in fact, only event_handler and xml should change)\n    '
	def __init__(self, focus=False):
		self._navigator = None
		if 'universe_switcher' in plugins:
			pass
		type_ = 'main'
		self.eventhandler = HomeEventHandler(self)
		Menu.__init__(self, type_, self.get_universes_items(), type=type_)
		def self._getitems_keywords['item_name']():
			if self.selected:
				pass
			return self.selected

		def self._getitems_keywords['parental_rating']():
			return self._get_parental_rating()

		def self._getitems_keywords['help']():
			return _('Enter Setup universe')

		self.get_item_list('main_list').cyclic = True
		try:
			pass
		if focus:
			self.select(self._HomeMenu__get_named(focus))
		else:
			if home_order:
				for name in home_order:
					if name[0] == '*':
						self.select(self._HomeMenu__get_named(name.lstrip('*')))
						break
						continue

	def _HomeMenu__get_named(self, name):
		for item in self['main_list']:
			if item.display_type == name:
				return item
				continue
		return 0

	def _get_parental_rating(self):
		if user_config['security']['parental_control'] and not user_config['security']['parent_mode']:
			pass
		return None

	def select(self, item, list_name=None, force_pos=False):
		if isinstance(item, basestring):
			item = self._HomeMenu__get_named(item)
		has_changed = Menu.select(self, item, list_name, force_pos)
		if has_changed is not False:
			louie_send('item_name', sender=self, action='update', value=omnicode(self['item_name']))
		return has_changed

	def show(self, hide_previous_menu=True, timeout=None):
		last_universe = user_config['advanced']['last_universe']
		if last_universe and 'restore_last_universe' in plugins:
			self.select(last_universe)
		Menu.show(self, hide_previous_menu, timeout)

	def execute_selected(self):
		sel = self.selected
		if sel:
			if self.type == 'switcher':
				ms = pygui_globs['menustack']
				if sel != ms.get_root().active_univ:
					ms.back_to_menu(None)
					ms.get_root().active_univ = sel
					sel.execute()
				else:
					ms.back_one_menu()
			else:
				sel.execute()
		return None

	def byebye(self):
		from pygui.facilities import minimalist_home
		minimalist_home.dump_home()
		stop()
		raise SystemExit('hasta la vista Catalina !')

	def get_universes_items(self):
		home_plugins = plugins.get('home')
		home_items = []
		root_menu = pygui_globs['menustack'].get_root()
		for universe in home_plugins:
			try:
				_[1], univ = [], UNIVERSE_LABELS[universe]
				home_items.append(ActionItem(univ.label, type_='main', action=getattr(root_menu, 'launch_%s' % universe), display_type=universe, args=univ.args))
				continue
			except KeyError, e:
				log.warning("The universe %s can't be loaded, error message below:\n%s" % (universe, str(e)))
				continue
			except AttributeError, e:
				log.warning('%s not implement in%s' % ('launch_%s' % universe, root_menu))
				continue
			PRINT_EXCEPTION()
			continue

	def reload_func(self):
		louie_send('item_name', sender=self, action='reset', value=self['item_name'])
		louie_send('main_list', sender=self, action='reset', value=self['main_list'])
		louie_send('parental_rating', sender=self, action='reset', value=self['parental_rating'])
		louie_send('help', sender=self, value=self['help'])
		if not user_config['base']['help_banner']:
			pass



from pygui.facilities.update import UpdateManager
